Wednesday, December 01, 2010

Brewing Unix tools in OS X

Brewery Hoepfner.-.Brew kettle

Mac OS X is a Unix-based operating systems which includes many of the wonderful tools you would expect in Linux or BSD, but there are many essential tools which are missing.

There are several ways to get Unix tools installed on your OS X system. Some offer OS X binary downloads, but most only offer their source as downloads. Tools like MacPorts offer interfaces which ease the search, download, compatibility patching and compilation process. I've tried these tools before and over time only resulted in headaches which would result in me removing and switching between the two packages.

Recently I found an new alternative to this process called Homebrew which is a new modern package management system that is faster and easier to maintain than MacPorts.

Homebrew packages are installed into their own isolated prefixes and then symlinked into /usr/local. Homebrew allows you to also create new packages and edit formulas (package install instruction) which are simple Ruby scripts.

Next, I'm going to walk you through the simple installation process (the only dependency for Home brew is having the XCode installed)

From the Terminal execute the following command

ruby -e "$(curl -fsSLk https://gist.github.com/raw/323731/install_homebrew.rb)"

This will download and execute the gist and then install Xcode

You should now be able to install any application located in the Homebrew repository. To get a list of available formulas enter the following command (basically you do an empty search)

brew search

You can browse the Formula folder on GitHub.

It is really simple to install a package using Homebrew (if you get and error like Error: Cannot write to /usr/local/Cellar you'll need to execute brew with sudo)


brew install wget

This will download and compile wget on your system. You can use the info command to get more information on the package and formula:

brew info wget

wget 1.12
http://www.gnu.org/software/wget/
/usr/local/Cellar/wget/1.12 (7 files, 576K)
http://github.com/mxcl/homebrew/commits/master/Library/Formula/wget.rb


If the package is not available in the repository you'll get the following error "Error: No available formula for package-name".

Homebrew also allows you to create new formulas which you can contribute back to the community using git. For more information on creating and contributing formulas take a look at the Formula Cookbook.

Here are some of the tools I've installed using Homebrew:
axel, iftop, mpg123, wget, git, irssi, lsof, mplayer, bmon, unrar, htop, mkvtoolnix, p7zip and w3m
For more information on Homebrew:

No comments:

Post a Comment