Carlo Cabrera 6dc90cbf83
cmd/shellenv: improve for newer macOS using /usr/libexec/path_helper
On macOS 14 and newer, `/usr/libexec/path_helper` supports setting a
`PATH_HELPER_ROOT` environment variable.

With this set, `path_helper` checks `$PATH_HELPER_ROOT/etc/paths` and
`$PATH_HELPER_ROOT/etc/paths.d` in the same way it checks `/etc/paths`
and `/etc/paths.d`.

We can use this to simplify management of the user's `PATH` variable
when they do `brew shellenv`. In particular, if their system supports
it, we delegate setting the `PATH` environment variable to `path_helper`
instead of our own code. We also write a default `etc/paths` file if one
is not already present.

This is nicer because it simplifies management of the user's `PATH`
variable. For example, if a user wants a keg-only formula to be in their
`PATH`, they can simply add the necessary path to `/etc/paths` or
`/etc/paths.d` without having to do something like `brew link --force`
or adding to `PATH` themselves.

When `/usr/libexec/path_helper` is not available, we just fall back to
the existing code.
2024-08-29 17:00:43 +08:00
..
2024-08-20 12:47:48 -07:00
2024-08-20 00:13:23 +00:00
2024-08-20 04:16:18 +01:00
2024-08-26 22:56:58 +00:00
2024-08-28 15:24:28 +00:00
2024-08-12 17:36:14 +01:00
2024-08-14 22:56:26 -04:00
2024-08-23 05:59:00 +01:00
2024-08-18 19:03:26 -04:00
2024-07-30 17:51:02 +01:00
2024-08-18 18:16:39 -07:00
2024-08-28 15:24:28 +00:00
2024-08-18 21:20:23 -06:00
2024-08-20 03:58:01 +01:00
2024-08-10 17:52:26 -07:00
2024-08-10 16:43:37 +01:00
2024-08-20 15:33:08 +01:00
2024-08-19 09:56:50 -07:00

Homebrew Ruby API

This is the API for Homebrew.

The main class you should look at is the {Formula} class (and classes linked from there). That's the class that's used to create Homebrew formulae (i.e. package descriptions). Assume anything else you stumble upon is private.

You may also find the Formula Cookbook and Ruby Style Guide helpful in creating formulae.

Good luck!