Getting Started

Installing brew Itself

ruby -e "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install)"

Installing software with brew

Installing Programs

Use the search command to search for a program, and see if it exists on brew (it always does)

brew search wget

Use the install command to download a program

brew install wget

Installing Applications

Use the cask command to install applications directly onto your computer

brew cask install google-chrome
brew cask install microsoft-office
brew cask install java

Multiple Installations with 1 Command

brew install wget watch tree

What all has been installed?

To see a list of programs that were installed by brew, as well as their dependencies, use the list command

brew list


What does this program depend on?

See the dependencies for wget

brew deps wget

What depends on this program?

See all packages that depend on python3

brew uses python3 --installed

Warning: If you don’t specify --installed it will show you every application that uses this program, even ones you haven’t installed on your computer.

What can I uninstall?

List all programs that nothing depends on.

brew leaves

Uninstall a program

brew uninstall wget

Where are my programs & applications installed?

brew will symlink all of the files that you have installed to /usr/local/bin which is automatically part of your $PATH in bash. Therefore, if you install wget then you can call it directly from bash, because the program can be accessed at /usr/local/bin/wget

Where is brew itself installed?

brew is usually installed at /Users/username/Library/Caches/Homebrew. You can check for yourself by typing

brew --cache

The services Command

Sometimes you want to install an application that needs to run at launch, such as a server. For example, let’s install two common database servers, MongoDB and MySQL

# [Install MongoDB & MySQL]
brew install mongodb && brew install mysql
# [Brew service list]
brew services list

Using the services command, brew makes it easy to configure when you want the server to start.

View current server configurations

brew services list

Starting a server

# [Configure the server to always start at runtime]
brew services start mongodb
# [Start the server, but just this once]
brew services run mongodb

Stopping a server

brew services stop mongodb

{ .notice–warning} Note: This will also prevent it from starting automatically the next time you login. The next time you want it to start you’ll have to use one of the two commands above.


If you try to install ruby with brew then you will notice it’s not in /usr/local/bin like most programs. The reason is because brew doesn’t want it to interfere with the native Mac OS version. Instead, it puts it in a different directory called /usr/local/opt. The directories inside of this folder are symlinks to the current version of the binary that’s installed. It adds a layer of protection, and makes sure that the version used is always the most current.

Making Your Own Homebrew Packages

It’s late so I’m going to rush through this, mostly just pasting code snippets for now.

  1. Make a repo on GitHub homebrew-taps
    • It can be homebrew-anything but I chose taps
  2. Add the formula for the tarball you want to install, in my case, drain.rb
class Drain < Formula
  desc "A command line tool to free up clogged ports"
  homepage "https://github.com/austintraver/drain"
  url "https://github.com/austintraver/drain/raw/master/archive/drain-1.0.tgz"
  sha256 "70d98fbe00ac67b8c3a19037c3e53db80b7cc048f60cd479bf74d1073a30463d"
  version "1.0"

  depends_on "coreutils"

  bottle :unneeded

  def install
    bin.install "bin/drain"
    man1.install "man/drain.1"

  1. To get the shasum, do shasum -a 256 ~/path/to/drain/archive/drain-1.0.tgz

  2. Push the drain repository to GitHub

  3. The drain repository should have the following layout:

├── archive
│   └── drain-1.0.tgz
├── bin
│   └── drain
├── lib
└── man
    └── drain.1
  1. brew tap austintraver/taps

  2. brew install drain