What is Homebrew?


The missing package manager for OS X !…

This post was meant to be a digestible e-mail to my significant other. I hadn’t (and still haven’t) managed to give a good verbal explanation of what Homebrew does. I had bookmarked a couple of Wikipedia pages a few weekends ago, with the intent of getting a better understanding of Homebrew in particular and package managers in general. My explanation draws directly from the wording in the linked Wikipedia and Github pages, i.e., info that’s more or less available to laypeople. When I realized it was going to take more than three fleshy paragraphs to develop a satisying explanation, this became a blog post.

If your eyes start to glaze over while you read this post, just fast-forward to the last couple paragraphs to see why Homebrew is delightful from a beer-lover’s point-of-view!!

As you can see from this brief Wikipedia article, Homebrew is a free and open-source software package management system. It’s run entirely on the command-line interface (CLI), and it installs Mac OS X software with a single line of text! In this list of package management systems, you’ll see Homebrew listed twice – once in the list of systems that distribute binary packages (alongside Apple’s App Store), and also in the list of systems that distribute the source code of their apps.

With over 5,600 contributors at the moment, Homebrew is one of the most popular open-source projects on Github. It has spawned several sub-projects, notably Homebrew Cask. Cask extends Homebrew to perform command-line installation for Mac GUI applications (e.g., Google Chrome, Ableton Live, or Vox) – also with a single line of text! Many users find this much more convenient than going through the process of navigating to a software program’s download page, downloading a file, and then dragging the icon to the Applications folder.

Cask currently has more than 2,500 Github contributors. Unlike Cask (and with a few exceptions), Homebrew itself is used to install and build command line tools or libraries, not GUI applications. (Amazingly, though, someone has made a GUI app for Homebrew – called Cakebrew!)

As for how Homebrew is implemented – Homebrew is written in Ruby and is meant to be compatible with the version of Ruby that comes installed with OS X (e.g., Yosemite and Mavericks ship with Ruby 2.0). It gets installed in the /usr/local directory on your computer and consists of a version-controlled Git repo. Thus, updating Homebrew on your computer is effectively similar to how you would update a local Git repository on your computer by synching with its source repository on Github.

As for how Homebrew installs and builds software packages – it makes use of Ruby scripts that are constructed with Homebrew’s domain-specific language (DSL), i.e., a mini-language or programming library written especially for use within Homebrew. There are thousands of these scripts in Homebrew, one for each software package. These scripts are responsible for managing dependencies (i.e., other software packages that need to be installed beforehand), as well as downloading source files and configuring and compiling software.

As glimpsed earlier with Cask, Homebrew incorporates lots of fun, beer-related terminology!

Here’s a brief overview:

Here’s a table showing where everything resides on your computer:

Thing Location on your computer
Homebrew! /usr/local/Library/
Tap /usr/local/Library/Taps/homebrew/homebrew-core
formula /usr/local/Library/Taps/homebrew/homebrew-core/Formula/foo.rb
Cellar /usr/local/Cellar/
keg /usr/local/Cellar/foo/0.1

In the screenshot below, you’ll see the command-line output resulting from running brew install youtube-dl. After downloading and “pouring” the tarball for OS X Yosemite, voilà! Homebrew displays a cute beer mug emoji and confirms the files that were written to the Cellar. youtube-dl is ready to be used, all thanks to a single line of command-line input!!

brew install

Beer is everywhere in Homebrew! Every now and then I encounter a reference I don’t understand, but I love it nonetheless. Something else I recently learned is the fact that anyone can create their own Homebrew Tap! While Homebrew’s main taps are restricted to select formulae, creating your own Tap and formulae is a nice way to distribute your own software to the Homebrew user community.