Resources

Install brew

See the brew.sh homepage.

Update list

Update Homebrew’s package list - this does not actually update packages. Note you probably don’t need to use this since an update is done before commands like install.

$ brew update

Manage packages

Install package

Install a specific package by its formula.

Note: Unlike apt, the update command is done internally to get the latest remote info - #1670.

$ brew install PACKAGE
$ brew install PACKAGE@VERSION  # e.g. gcc@7 python@3.9

Warning: The install command will also upgrade all installed packages.

Install without auto-upgrade - from article.

$ HOMEBREW_NO_AUTO_UPDATE=1 brew install PACKAGE

Set in .bashrc or .zshrc.

$ export HOMEBREW_NO_AUTO_UPDATE=1

Install cask

See also Homebrew casks.

$ brew cask install CASK_NAME

Upgrade

Upgrade one package

$ brew upgrade PACKAGE

Upgrade all packages

Update outdated packages. WARNING Use this with caution - it can break Python virtual environments for example.

$ brew upgrade --dry-run

$ brew upgrade

Here is a shortcut I found - from article.

alias brewery='brew update && brew upgrade && brew cleanup'

Help

$ brew upgrade --help
Upgrade outdated, unpinned formulae using the same options they were originally
installed with, plus any appended brew formula options. If formula are
specified, upgrade only the given formula kegs (unless they are pinned; see
pin, unpin).

Unless HOMEBREW_NO_INSTALL_CLEANUP is set, brew cleanup will then be run for
the upgraded formulae or, every 30 days, for all formulae.

Taps

$ brew tap <TAP_NAME>/taps
$ brew install <TAP_NAME>

e.g.

$ brew tap isacikgoz/taps
$ brew install gitbatch