Many command line tools (e.g. wget, pstree) don’t come pre-installed on Mac. Homebrew is one of the easiest ways to install and manage these missing packages on Mac. Homebrew is written mostly in ruby. the brew command itself is a shell wrapper over ruby code. This article is a quick start guide for using homebrew on mac.
These are the steps to install homebrew:
- Install Xcode on your Mac. Easiest way to install it using App store (look for applciation “App Store” in application finder). You will need an appleid for installing Xcode from App Store. The download is more than a GB and it may take few hours. Here is how Xcode package looks like in App store.
- Install homebrew using one liner instructions mentioned at homebrew home page. This is the command to install it at the time of writing this article.
ruby -e "$(curl -fsSL https://raw.github.com/Homebrew/homebrew/go/install)"
You may want to double check for any potential update in the command. The command will download and execute the ruby install script. After the install, the brew wrapper is placed at
/usr/local/bin/brewand ruby files at
These are some handy commands using brew:
- Install some useful packages like wget, node.js, etc.
$ brew install wget $ brew install node $ brew install pstree
Brew uses a formula file written in ruby which contains compile/install rules for the package. Some of the formulas can be see at homebrew github formulas site. These packages are installed at
- To list all homebrew installed packages
$ brew list
- To list all files of an installed packages
$ brew list --verbose wget // or $ brew list -v wget
- To uninstall a homebrew package
$ brew uninstall wget
- To update a homebrew itself
$ brew update
- To upgrade a homebrew package
$ brew upgrade wget
- To upgrade a homebrew package from devel
$ brew upgrade wget --devel
- To list info (version, installed files location, etc.) about an installed homebrew package
$ brew info wget