Mac brew (homebrew) – quick start guide

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.


Installing Homebrew

These are the steps to install homebrew:

  1. 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.
  2. 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"

    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/brew and ruby files at /usr/local/Library/brew.rb and /usr/local/Library/Homebrew/

Using homebrew

These are some handy commands using brew:

  1. 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 /usr/local/Cellar/.

  2. To list all homebrew installed packages
    $ brew list
  3. To list all files of an installed packages
    $ brew list --verbose wget
    // or 
    $ brew list -v wget
  4. To uninstall a homebrew package
    $ brew uninstall wget
  5. To update a homebrew itself
    $ brew update
  6. To upgrade a homebrew package
    $ brew upgrade wget
  7. To upgrade a homebrew package from devel
    $ brew upgrade wget --devel
  8. To list info (version, installed files location, etc.) about an installed homebrew package
    $ brew info wget
Share this article: share on Google+ share on facebook share on linkedin tweet this submit to reddit


Click here to write/view comments