Installing HomeBrew on Mac

One of the best tools for installing software on a Mac is the HomeBrew system. HomeBrew is a Ruby based program that uses a “formula” to define how to download and install a large number of popular programs. HomeBrew will manage compiling many of these packages from source code, making sure that everything on your system is up to date and works well.

Installing

HomeBrew is a Ruby program, so we need a recent version of Ruby on the Mac. Fortunately, the default installation of Mac OS-X has Ruby installed:

ruby --verison
ruby 1.8.7 (2012-02-08 patchlevel 358) [universal-darwin12.0]

This command will install HomeBrew:

ruby -e "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install)"

Setting the system path

HomeBrew installed packages as a normal user (it does not need sudo for most commands). All packages are installed under /usr/local/Cellar (where else would you keep your “brew”?), then linked into /usr/local/bin. We need to make sure the packages installed by HomeBrew are chosen before any default versions installed on your system. To make this happen we need to add a line to your .bash_profile file in your home directory.

Note

This file is not present by default on the Mac. Just create it with a text editor.

export PATH="/usr/local/bin:$PATH"

Updating the system

With HomeBrew installed, you will need to update your system so the tool can find the most current packages. This should be done periodically, especially before installing a new package:

brew update

Checking the installation

Another good thing to do periodically is to make sure HomeBrew is happy with the setup on your system. Run this:

brew doctor

If any issues are reported, it is a good idea to resolve them right away. Most issues can be figured out with a bit of “Googling”