Jason Storz, a principal consultant at Redstone Content Solutions asked a great question on Twitter:
@chadothompson home brew vs macports – why one over other?
— jasonstortz (@jasonstortz) April 27, 2013
This was a question that I started to answer with a bit of history behind it. Some of the history is rather dull, but it does get to why I like using Homebrew as a package manager over the other alternatives.
Way back when, many of us started replacing dual Windows/Linux machines with OS X boxes. (Mine was the ultra-sleek Titanium PowerBook. It could support a full 1 GB of RAM!) The one thing that was missing was a good UNIX (well, or really “Linux”) style package management tool. Enter the Fink project which was the first management tool in the style of the Debian
apt-get package manager. Fink was very cool, with one major flaw at the time: Fink packages were binary. While they worked like a champ, the rapid pace of OS X development in the early 2000s made binary compatibility something of a fool’s errand. When Apple released new versions of OS X, Fink would often lag a few months behind in supporting the new version. Not that this was the fault of the maintainers of Fink, it arose from the problem that Apple simply didn’t care enough about UNIX users to be concerned with binary compatibility. The developer community was pushed and shoved by the platform a few times – most notably in the Intel transition and the concept of the “Universal Binary”. Open source package management outside of tight communication with Apple was nearly impossible. (It should be noted that this situation has likely changed as OS X has become more mature – the internals are no longer the Wild West of binary incompatibilities and API changes.)
Some of the developers behind the Darwin project noted the problem and created a package manager similar to the BSD “ports” system initially called “Darwin Ports”, now MacPorts. MacPorts did (and still does) have the advantage of working a little more closely with core “Darwin” (and OS X) developers, but MacPorts does put a little distance between the version of OS X and the capabilities that MacPorts can provide. MacPorts does this by building a separate dependency tree that the ‘typical’ OS X tools, or the need to install Xcode or the Apple Developer tools.
(Everything is placed in
/opt/local, and dependencies between the system packages and the Ports tree are minimal, if entirely non-existant.)
What I found in practice: my
/opt/local/ directory grew to insane proportions and if I upgraded OS X (or even moved to a new machine like happened a few times), I was starting completely from scratch. There was also a lag between OS releases and a new “Ports” release, and the occasional incompatibilities between ports that would give you very odd build errors.
Enter Homebrew, designed around two principles that make package management vastly simpler (IMO):
- Creating a Homebrew package is very simple. All you need is a little working knowledge of Ruby and the Ruby
gempackaging system and you can create a Homebrew package. This has been pretty handy as I’ve been doing a little more work with Ruby and Puppet lately – it’s more likely that Homebrew packages will be up to date and functional.
- Homebrew works with OS X as much as it can – no ‘external’ dependencies for compilers or build tools; it uses Xcode for build dependencies which helps ensure that there will be some compatibility between Homebrew packages and the host OS.
- Homebrew is in essence a simple wrapper behind the UNIX
configure, make, make installprocesses. Nothing requires binary capability, and external libraries required in the dependency tree are also built in the same way. Troubleshooting issues with Homebrew compilations and dependencies has been (IMO) much easier. Homebrew is also very self-contained, you can remove packages and items that Homebrew has installed without compromising the integrity of your system. (At least that I’ve encountered.)
(NOTE: Homebrew does ‘bottle’ some software to be installed as a binary for stable libraries, but it does offer you the choice on install to use binaries where it makes sense. See the Homebrew FAQ for more detail.)
In essence, I’ve grabbed onto Homebrew as a package manager primarily because it works with less frustration than Fink or MacPorts did. This might be different in 2013, but it’s been a long road getting here and Homebrew “just works” for me.