The easiest way to install various Unix tools and open source software onto OS X is via a package manager or repository, unfortunately OS X doesn’t come with one, but fortunately there are some good folks that care. They come in the form of Homebrew.
Homebrew isn’t the only option, also available is MacPorts and Fink but Homebrew is the newest and easiest of the trio.
Compatible in OSX 10.8 Mountain Lion…
Get Xcode
Get Xcode 4.6 from the Apple app store, free download version, then install it and launch it from the /Applications folder. Go to Xcode preferences and then look in the ‘Downloads’ button.
Install the command line tools from the preferences of Xcode.
Install Homebrew
To download install Homebrew run the install script on the command line as below and let the script do its thing:
ruby -e "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install)"
Download and install XQuartz brew will moan as it is no longer installed as part of 10.8 and Xcode
After installing and as suggested in the command line, to check for any issues with the install run:
brew doctor
If upgrading from a previous OSX version, update Xcode location
sudo xcode-select -switch /Applications/Xcode.app/Contents/Developer
To search for an application:
brew search
To install
brew install <application-name>
To list all apps installed by Homebrew
brew list
To remove an installed application
brew remove <application-name>
To update Homebrew
brew update
To see what else you can do
man brew
Where does Homebrew install stuff …. in the Cellar
/usr/local/Cellar/
Where the brew lives.