Playing with Homebrew on Mac OS X


Homebrew running on my Mac Pro this afternoon

In January I started trialling Homebrew, the new package manager for Mac OS X. With my latest system rebuild, I’ve moved to it exclusively, and am loving it!

Homebrew means coffee, right?

Ironically despite only being a partially free/open source OS, Mac OS X users are spoiled for choice when choosing a package management system to install free/open source software:

  • MacPorts (formerly DarwinPorts) is a source-based system that’s functionally similar to FreeBSD’s ports system, though easier to update in my opinion.

  • Fink is a source and binary based system that’s broadly equivalent to Debian’s apt-get.

  • NetBSD’s comprehensive pkgsrc system can be bootstrapped provided the target volume is case sensitive.

  • While not a package manager per sé, Rudix conveniently bundles some of the most common *nix command line software, tools, languages and libraries into one package. For new Linux to Mac converts who want to leave package managers behind, I recommend this to give them the tools they’re used to.

  • Apple’s App Store… wait no. Actually that’s a good question, can you distribute free/open source software through that, or will you be vilified and VLC-d by the FSF? Eh, just use MacLibre for that :)

When I first heard about Homebrew, I have to admit my first thought was "geez, another one!?" My tune quickly changed when I learned more about it.

The goodness

In CatB, the legendary Eric S. Raymond commented that every good work of software starts by scratching a developer’s personal itch, and that’s evident with the design of Homebrew. The entire system is based off Git, and individual formulas (their terminology for ports/packages) are simple Ruby files. I’m ready to dive off Mercurial and learn more Git just to see all the cool stuff I can do with this!

My favourite feature however is how formulas are installed. In a nod to NeXT/Mac OS X application packages and PC-BSD’s PBI system, instead of dumping everything into ungainly POSIX folders like almost every other package manager, Homebrew installs formulas into their own directories in $HOMEBREW_PATH/Cellar, then create symlinks into their expected POSIX folders so you merely have to add $HOMEBREW_PATH/bin to your $PATH. Compatible, but clean!

Homebrew listing my installed brews in the Cellar

Where Ruben differs

In keeping with not being tied down to how traditional package managers operate, the Homebrew team suggests you take ownership of the /usr/local/ directory, then install Homebrew there.

Their justifications seem reasonable, but the idea rubs me the wrong way. I don’t want Homebrew clashing with the software I already build and maintain myself in /usr/local/, and personally chown-ing such a critical directory goes against everything I’ve learned about security and segregation.

Fortunately the Homebrew developers took into account there’d be crusty, inflexible people like me using their system, so you can elect to install it wherever you want. I chose to use the old standard /opt/local/, assign it to root, and bootstrap:

% sudo -s
# mkdir -p /opt/local
# curl -L \
| tar xz --strip 1 -C /opt/local

Then its just a matter of updating your shell's $PATH and $MANPATH to point to your newly created directories. Too easy!

Installing stuff

Probably the first thing you’ll want to do is run an update, which requires Git. The procedure is super complex.

# brew install git
# brew update

Now you’re ready to install all your FLOSS goodness! To see what’s available you can browse the formula directory on Github, or you can use brew search. If you’re a Git ninja, once performing an update you can perform all the Git commands you’re used to.

Finally, I often judge projects based on the quality of its documentation. brew help lists all the available commands, and the brew manpage is very clear and well written. Kudos :).

Group hug

Credit goes to Andrew Carter who shared my skepticism about installing Homebrew into /usr/local. Thanks also to the people behind Homebrew for this awesome software, and to the MacPorts maintainers for all the tireless work you did over the years to keep my Mac brimming with FLOSSY goodness. Your efforts have all been highly appreciated :).

Author bio and support


Ruben Schade is a technical writer and infrastructure architect in Sydney, Australia who refers to himself in the third person. Hi!

The site is powered by Hugo, FreeBSD, and OpenZFS on OrionVM, everyone’s favourite bespoke cloud infrastructure provider.

If you found this post helpful or entertaining, you can shout me a coffee or send a comment. Thanks ☺️.