Homebrew the Package Installer for Mac

How to use and install Homebrew command line package installer.

Posted by Kirk on 4 January 2016

Homebrew is the very easy package installer for OS X. It's really easy to use and in my opinion it's superior to MacPorts. It would be wise to get rid of your MacPorts installation, if you have one, prior to proceeding, see the instructions below.

Uninstalling MacPorts

In case you want to clean out your MacPort installation, as mentioned above do the following:

sudo port -f uninstall installed

sudo rm -rf \
    /opt/local \
    /Applications/DarwinPorts \
    /Applications/MacPorts \
    /Library/LaunchDaemons/org.macports.* \
    /Library/Receipts/DarwinPorts*.pkg \
    /Library/Receipts/MacPorts*.pkg \
    /Library/StartupItems/DarwinPortsStartup \
    /Library/Tcl/darwinports1.0 \
    /Library/Tcl/macports1.0 \

As Apple does not touch /usr/local you can clean that out as well, as anything there would have been put there by MacPorts, and since Homebrew installs under /usr/local it's good if it is clean. Of course this all depends what you have been doing with your Mac.

Installing Homebrew

You can find Homebrew's github page here and of course the recommended installation instructions, which at the command line is:

ruby -e "$(curl -fsSkL raw.github.com/mxcl/homebrew/go)"

This will download the "go" ruby script and execute it all in one go. In summary the script changes permissions on various directories, downloads the Homebrew install files and installs them under /usr/local.

Some key files that will be installed by the Hombrew installer are:


The script does all the heavy lifting of installing, uninstalling, listing installed packages and displaying package information as well as other tasks.


This is the directory where files are installed for all your installed packages.

Using Homebrew

This command will list all your package directories on your machine:

ls -dF1 /usr/local/Cellar/*

The out put of that command will look something like this:


Once installed, all that is required is to run brew install to install new packages.

Packages are initially downloaded to /Library/Caches/Homebrew/, so if you uninstall and then reinstall the package will not be downloaded a second time. To get a listing of your cache directory use:

ls -1 /Library/Caches/Homebrew/*

However if you use a cleaner program it may clean out the cache periodically.

Posted in:

comments powered by Disqus