Make Mac OS X Even More Awesome with Homebrew

One of the great things about Mac OS X is the ability to use a traditional shell — Bash — as the native command line interface.  However, those accustomed to the rich environment of a Linux Bash shell may miss many of the handy CLI tools that don’t typically come with Mac OS X. Thankfully, there is a very easy-to-use package manager called Homebrew to fill this niche.

Dependency Alert

Homebrew makes use of the Apple Command Line Tools, which are handy additions to your Mac as well.  Downloading the tools is easy but requires registering as an Apple Developer first — it’s fast and free.  After logging in, look for something like this:

Download Apple Command Line Tools

Homebrew Installation in a Snap

After installing the Apple tools, installing Homebrew is as easy as this one-liner:

Here are some handy management commands to get started:

Once Homebrew is set up, it’s easy to add useful utilities to your Mac; to browse an interactive catalog take a look at Braumeister.  Here are some suggestions to try:

  • nmap
  • mtr
  • dos2unix
  • watch
  • wget

An interesting characteristic of Homebrew is that in most cases it actually downloads source code and compiles it for your system.  I see this as generally positive, using the genuine version of an app instead of a one-off binary ported and built by an individual.  Having said that, a feature known as bottles enables binary packages to be distributed.

Another appealing design attribute is that Homebrew is quite safe to use — it installs everything under /usr/local/ and symlinks from appropriate locations:

Now that you’re enhancing the Mac command line, it’s time to really up the ante…

Bash Completion on Mac OS X

The Bash shell has a very versatile and productivity-boosting completion mechanism.  By default it works like most command shells, automatically expanding directory and file names by hitting ‘tab’ – but there is much more potential, such as completion of hostnames when using ssh.  Once Homebrew is up and running, simply do this to enable completion for a broad range of CLI tools:

Homebrew bash-completion

Edit your .bash_profile as described above to enable completion so you can just hit ‘tab’ to let the productivity begin!

Tags: ,