cheat-sheets

Homebrew

Homebrew is the package manager for macOS (and Linux). It installs command line tools (“formulae”) and GUI apps (“casks”). On Windows use Chocolatey; on Debian and Ubuntu use apt.

Homepage and docs: brew.sh, Homebrew Docs


Install #

Copy the one-line install command from brew.sh (read the script first if you prefer). On Apple Silicon, Homebrew lives in /opt/homebrew; add it to your shell:

zsh
echo 'eval "$(/opt/homebrew/bin/brew shellenv)"' >> ~/.zprofile
eval "$(/opt/homebrew/bin/brew shellenv)"

Intel Macs use /usr/local, and Linux uses /home/linuxbrew/.linuxbrew. Run brew doctor after installing. See Docker on macOS Silicon for Apple Silicon notes.

Everyday Commands #

COMMANDDESCRIPTION
brew install <FORMULA>Install a CLI tool
brew install --cask <APP>Install a GUI app
brew search <TEXT>Search
brew info <NAME>Details and caveats
brew list / brew list --caskInstalled formulae / casks
brew uninstall <NAME>Remove
brew uninstall --zap --cask <APP>Remove an app and its leftovers
brew updateUpdate Homebrew and the package list
brew outdatedShow what can be upgraded
brew upgradeUpgrade everything (or brew upgrade <NAME>)
brew cleanupRemove old versions and caches
brew doctorDiagnose problems
brew deps --tree <NAME>Dependency tree
brew pin <NAME>Hold a formula at its current version

Services #

COMMANDDESCRIPTION
brew services listBackground services
brew services start <NAME>Start now and at login
brew services restart <NAME>Restart
brew services stop <NAME>Stop

Taps #

COMMANDDESCRIPTION
brew tap <USER/REPO>Add a third-party repository
brew tapList taps
brew untap <USER/REPO>Remove one

Brewfile (Reproducible Setup) #

bash
brew bundle dump --file=~/Brewfile --force
brew bundle --file=~/Brewfile

brew bundle dump writes everything installed into a Brewfile. Commit it to a Git repository to rebuild a machine in one command. A Brewfile contains lines such as brew "jq", cask "iterm2" and tap "homebrew/cask-fonts".

Tools Covered Here #

kubernetes-cli (Kubectl), k9s (K9s), kind (Kind), helm (Helm Cheat-Sheet), jq (jq), tmux (tmux), starship (Starship Prompt), gh (GitHub and the gh CLI), azure-cli (Azure CLI (az)), awscli (AWS CLI), iterm2 (iTerm2).

Not Verified #

Written from knowledge of Homebrew and not run here.

Search all sheets

Tip: / or Ctrl/Cmd+K to open, Esc to close.