Homebrew Reference

Kip Landergren

(Updated: )

Contents

Commands

brew deps

Show dependencies for formula.

brew deps [FORMULA]

Show all deps for FORMULA, in tree format:

brew deps --tree --installed [FORMULA]

Show all deps for all packages, in tree format:

brew deps --tree --installed

brew doctor

Check your system for potential problems.

brew help

brew help
brew help [COMMAND]

brew info

Display brief statistics for your Homebrew installation. If a formula or cask is provided, show summary of information about it.

brew list

List all installed formula and casks:

brew list

Summarize the paths within a formula’s keg:

brew list [FORMULA]

List pinned formula:

brew list --pinned

brew pin

Pin the specified formula preventing them from being upgraded.

brew pin [FORMULA]

brew uninstall

Uninstall a formula or cask.

brew uninstall [FORMULA]

brew unpin

Unpin the specified formula allowing them to be upgraded.

brew unpin [FORMULA]

brew update

Fetch the newest version of Homebrew and all formulae. Remember that formula are just the package definitions—this does not install the new packages and is not the same as brew upgrade.

brew update

brew upgrade

Upgrade outdated casks and outdated, unpinned formulae. Specify [FORMULA] to just upgrade that formula.

brew upgrade [FORMULA]

brew search

Search for formula.

brew search [FORMULA]

FAQ

How do I install a specific version of a package?

Find the version you want:

brew search FORMULA_NAME@

Uninstall the installed version

brew uninstall FORMULA_NAME

Install the desired version:

brew install FORMULA_NAME@20

Make sure that $PATH contains the latest version by updating .bashrc or .bash_profile:

export PATH="/usr/local/opt/FORMULA_NAME@20/bin:$PATH"

How to disable auto update?

HOMEBREW_NO_AUTO_UPDATE=1 brew install [formula]

Via How to install an homebrew formula without updating homebrew\ itself?.

How do I tell if the software / program / package was installed by Homebrew?

Query the list of formula homebrew manages:

$ brew list | grep mysoftware

Query the formula directly:

$ brew info krb5
==> krb5: stable 1.21.2 (bottled) [keg-only]
Network authentication protocol
https://web.mit.edu/kerberos/
Not installed
From: https://github.com/Homebrew/homebrew-core/blob/HEAD/Formula/k/krb5.rb
License: Cannot Represent
==> Dependencies
Required: openssl@3 ✘
==> Caveats
krb5 is keg-only, which means it was not symlinked into /usr/local,
because macOS already provides this software and installing another version in
parallel can cause all kinds of trouble.
==> Analytics
install: 62,493 (30 days), 193,182 (90 days), 925,277 (365 days)
install-on-request: 2,962 (30 days), 9,879 (90 days), 202,831 (365 days)

Resources

Homebrew Terminology

bottles
binary packages
cask (extension)
an extension of Homebrew that supports installing native/GUI applications
cask (package definition)
the package definition for native/GUI applications
cellar
directory location of kegs; e.g. /usr/local/Cellar
default prefix
the name of the formula as invoked by the command line; e.g. rbenv instead of the full installation prefix rbenv/1.1.2
formula
the package definition; written in a ruby-based DSL for how to build and install the software
keg
the installation prefix of a formula; e.g. rbenv/1.1.2
taps
third-party repositories containing formula or casks