Homebrew calls itself The missing package manager for macOS and is an essential tool for any developer.
An important dependency before Homebrew can run is the Command Line Tools for Xcode. These include compilers that will allow you to build things from source, if you are missing this it’s available through the App Store > Updates.
To install Homebrew paste the following command (without the $) in your terminal, hit Enter, and follow the steps on the screen:
$ ruby -e "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install)"
One thing we need to do is tell the system to use programs installed by Hombrew (in
/usr/local/bin) rather than the OS default if it exists. We do this by adding
/usr/local/bin to your $PATH environment variable:
$ echo 'export PATH="/usr/local/bin:$PATH"' >> ~/.bash_profile
Alternatively, we can also insert
/usr/local/bin to the first line of
/private/etc/paths and reboot the Mac to change global paths loading order. Admin password may be required if you modify the file.
To be able to use brew you need to start a new terminal session. Do this by opening a new terminal tab with Cmd+T (you should also close the old one), then run the following command to make sure everything is working:
$ brew doctor
To install a package (or Formula in Homebrew vocabulary) simply type:
$ brew install <formula>
To update Homebrew’s directory of formulae, run:
$ brew update
Note: I’ve seen that command fail sometimes because of a bug. If that ever happens, run the following (when you have Git installed):
$ cd /usr/local/Homebrew/
To see if any of your packages need to be updated:
$ brew outdated
To update a package:
$ brew upgrade <formula>
Homebrew keeps older versions of packages installed, in case you want to roll back. That rarely is necessary, so you can do some cleanup to get rid of those old versions:
$ brew cleanup
To see what you have installed (with their version numbers):
$ brew list --versions
Homebrew-Cask extends Homebrew and allows you to install large binary files via a command-line tool. Examples of these files is Google Chrome, Dropbox, VLC and Spectacle.
As of December 2015, Cask comes installed with Homebrew, if you have not installed Homebrew see the Homebrew section.
To see if an app is available on Cask you can search on the official Cask website. You can also search using the following command:
$ brew cask search <package>
These plugins adds support for the corresponding file type to Mac Quick Look (In Finder, mark a file and press Space to start Quick Look). The plugins includes features like syntax highlighting, markdown rendering, preview of JSON, patch files, csv, zip files and more.
$ brew cask install \
Here are some useful apps that are available on Cask.
$ brew cask install \