Homebrew

Homebrew calls itself The missing package manager for macOS and is an essential tool for any developer.

Installation

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:

1
$ 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:

1
$ 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:

1
$ brew doctor

Using Homebrew

To install a package (or Formula in Homebrew vocabulary) simply type:

1
$ brew install <formula>

To update Homebrew’s directory of formulae, run:

1
$ 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):

1
2
3
$ cd /usr/local/Homebrew/
$ git fetch origin
$ git reset --hard origin/master

To see if any of your packages need to be updated:

1
$ brew outdated

To update a package:

1
$ 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:

1
$ brew cleanup

To see what you have installed (with their version numbers):

1
$ brew list --versions

Homebrew Cask

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.

Installation

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:

1
$ brew cask search <package>

Quick Look plugins

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.

1
2
3
4
5
6
7
8
9
10
$ brew cask install \
qlcolorcode \
qlstephen \
qlmarkdown \
quicklook-json \
qlprettypatch \
quicklook-csv \
betterzipql \
webpquicklook \
suspicious-package

App Suggestions

Here are some useful apps that are available on Cask.

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
$ brew cask install \
alfred \
android-file-transfer \
asepsis \
appcleaner \
caffeine \
cheatsheet \
docker \
doubletwist \
dropbox \
google-chrome \
google-drive \
google-hangouts \
flux \
latexian \
1password \
pdftk \
spectacle \
sublime-text \
superduper \
totalfinder \
transmission \
valentina-studio \
vlc
^