Homebrew
Homebrew is a Ports-like packaging system for macOS.
Things I like about Homebrew
(All of these are critical criteria for third-party package management)
- Self-contained (nothing is installed outside of its installation prefix)
- Use of pre-built binaries when possible (mitigates the classic Ports-family issue of waiting forever to install something)
- Well-maintained recipes
- Attempts to not conflict with system-provided binaries
- Does not attempt to manage/replace my entire system/build environment
Things I don't like about Homebrew
- Installation instructions promote a
curl | sh
anti-pattern (what's wrong with a native macOS.pkg
?) - The default is to install to
/usr/local
, which should be reserved for user-built binaries ('managed' builds should live in/opt
) - It has a preference for granting unprivileged users wide-scale privileges (i.e., whomever runs
brew
needs permission to write to the installation prefix directly) - Ridiculous terminology
How I use Homebrew
- I keep Homebrew in
/opt/brew
;/opt/brew/bin
is in my$PATH
. /opt/brew
is owned by a_homebrew
user, which is a non-privileged system account (its home directory is/var/lib/homebrew
, and ensures a~/Library
tree can be written-to independently of the installation prefix or ultimately-invoking user)- I have a
sudoers
file which allows execution of/opt/brew/bin/brew
as_homebrew
by certain users (i.e.,sudo -u _homebrew -H /opt/brew/bin/brew ...
- I have a wrapper script,
/usr/local/bin/brew
, which appears in my$PATH
before/opt/brew/bin
, and which simply executes thesudo
command above, passing it any supplied command-line arguments
Currently, this is managed via Puppet on my Macs, but it really should be possible to generate a signed Homebrew .pkg
which does all of this from the Homebrew Github repository via Travis
Caveats
Installing somewhere than /usr/local
is not recommended by Homebrew. My use-cases mean I've yet to run into any issues.
I will tend to install upstream native packages in preference to Homebrew builds where available (e.g., Puppet, pandoc
, Node, Python, etc.)