There have been several different package management tools that have appeared for Mac OS – Fink, MacPorts and now Homebrew. Created by Max Howell former developer at Last.fm (led the work on all of their desktop and mobile software) it has become one of the most popular projects forked on GitHub.
Like the others it’s a simple method of installing open source software, but it is built to keep them in line with software that is already installed either by yourself or the default stuff in Mac OS. This is due to it giving you control over where it’s installed,a loose policy of not duplicating what is in CPAN, Python Easy_install, pip or Ruby gems and that Homebrew allows you to see what is going on in the background during the install which hopefully encourages you to make changes yourself.
Requirements
If you plan on creating your own fork to add your own formulas you should install the following:
Where To Install
One advantage of installing it in /usr/local is that it is already in your PATH which lets any future software that you install work with stuff installed by Homebrew and for Homebrew to work with anything you already have there. You can install Homebrew anywhere, but it make sense to have it at /usr/local for the reasons stated above.
Download And Install
Grab the latest copy from Max’s repository on GitHub and place them in /usr/local.
curl -L http://github.com/mxcl/Homebrew/tarball/master / | tar xz --strip 1 -C /usr/local
If you want to create your own fork go to Homebrew’s GitHub page and click “Fork”. Now to install at /usr/local run the commands below, but change YOURGITHUBNAME to your github account name.
cd /usr/local git init git remote add origin git://github.com/YOURGITHUBNAME/homebrew.git git pull origin master
Starting Off
Now Homebrew is installed at /usr/local with the following directories:
/usr/local/Library/Contributions - contributions /usr/local/Library/Formula - the formulas /usr/local/Library/Homebrew - files for Homebrew itself /usr/local/Cellar - placeholder for items installed by Homebrew (they get symlinked to /usr/local/bin, /usr/local/lib etc)
Two commands you should start off with is search and info.
search – search to see if there is a formula in the local copy of Homebrew, remember people are adding formulas and they will not find themselves added to Max’s copy immediately. So check the tickets to see if someone has already created what you are looking for.
brew search apache
info – shows the version of the software that the formula installs, the homepage for the project, dependencies, if it is already installed shows its location and then any caveats (quick and dirty readme) that might be in the formula.
brew info apachetop
There reasons I stopped using Homebrew
When you install a formula Homebrew does not show you the dependencies and it will install them without prompting you. I don’t like the idea of having a script making changes that I’ve not approved of and I shouldn’t have to open up each formula and follow the dependency path to see what’s getting installed. It is a common practice to display any additional packages that will be installed by a package management tool like in the example below using Yum.
The last point I have is more of a personal preference and observation. And that is how Homebrew works with any formula using version control to check out the software in place of downloading a tar file. If you look in formula.rb you will see the checks for the different URL prefixes that common version control systems use and a few that have to include the domain name and path for URLs that are using a common prefix like http or https.
Adding a regex check for these common URL prefixes will become a management pain in the ass and the user would be better served if the formula would specify the VCS used and if not formula.rb could still default to using the CurlDownLoadStrategy. As more formulas are added using version control additional regex checks would need to be added from time to time and specifying the VCS used in the formula would help keep things simple. And this wouldn’t require someone to update formula.rb for any new formulas that use a common prefix along with version control. It would already be set.
If neither of these points are an issue for you and you would like to have your package management system use your existing installed software then you should fine Homebrew a good fit.
More information on Homebrew and some of the other package management tools for Mac OS.