David Calhoun

Developer Tools: Homebrew

I recently got a new MacBook Pro & had to go through the motions of setting up my development environment. One of my favorite tools for managing my environment is the Mac OS X package manager tool Homebrew. The following is a brief overview/tutorial of Homebrew.

As a front end developer I’m not nearly nerdy enough to understand many of the details behind the packages I use, but I do know that several of them are required to accomplish the projects that I work on. Homebrew allows me to easily install & maintain those packages.

Homebrew is very easy to install. The documentation site provides one simple Terminal command to get you started:

ruby -e "$(curl -fsSL https://raw.github.com/Homebrew/homebrew/go/install)"

Installing Your First Package

After you finish the installation, Homebrew is a tool that is very straightforward to use. Before installing a package it’s good practice to ensure that Homebrew is up to date & in working order.

brew doctor

The above command is Homebrew’s built-in utility to check its structure & heath status. The doctor command will let you know if your Homebrew is out of date or there are any issues with your package installations.

I like to use Yeoman & a generator I created called Playbook, so one of the first packages I install is Node.js. Installing a package is a simple as running the install command:

brew install node

Updating a Package

As time goes on you are of course going to need to update packages you have installed. It’s typically best to update Homebrew first & then the out-of-date package.

brew update
brew upgrade node

Homebrew’s installation is, in reality, a clone of a Git repository. The update command will pull down the latest information from Homewbrew for you. It will also list out any package formulas that were updated in the process. After you have the latest Homebrew forumlas, you can use the upgrade command to update a specific package.

Other Helpful Commands

brew list           # shows a list of installed packages
brew outdated       # shows a list of out of date packages
brew info node      # shows information about a specific package
brew uninstall node # uninstalls a specific package

That’s it! For most use cases that will be all you need. There are additional commands & more information available on the wiki if you’d like to continue reading more about Homebrew. If you have any questions, feel free to leave a comment below.

Questions, Comments, Suggestions? Open an Issue.