Skip to content

/cheatsheets/homebrew/brew-cheat-sheet

Homebrew cheat sheet: install, upgrade, services and Brewfile

The commands on this page have not been executed by our verification runner yet.updated 2026-10-20
tool
Homebrew
versions
Homebrew 4.x
os
macos, linux

The Homebrew commands used every day. Formulae are command-line packages built or poured from bottles; casks are macOS apps and other prebuilt binaries.

Install and remove

CommandDoes
brew install wgetinstall a formula
brew install --cask firefoxinstall an app (cask)
brew uninstall wgetremove it
brew autoremoveremove dependencies nothing needs any more
brew search postgresfind formulae and casks
brew info nodeversions, dependencies, caveats

Update

CommandDoes
brew updateupdate Homebrew and the package index
brew outdatedlist packages with newer versions
brew upgrade [name]upgrade everything, or one package
brew pin nodekeep node at its current version during upgrade
brew cleanupdelete old versions and cached downloads
brew doctordiagnose common problems

Versions and services

bash
brew install postgresql@17        # versioned formula
brew services start postgresql@17 # run in the background, start at login
brew services list
brew services stop postgresql@17
brew --prefix                     # /opt/homebrew on Apple silicon, /usr/local on Intel, /home/linuxbrew/.linuxbrew on Linux

Reproduce a machine with a Brewfile

Brewfile
brew "git"
brew "node"
cask "visual-studio-code"
bash
brew bundle dump --file=Brewfile   # write the current setup
brew bundle --file=Brewfile        # install everything listed
brew bundle check                  # is everything installed?

If brew is "command not found" after installing on Apple silicon or Linux, add it to the shell with eval "$(/opt/homebrew/bin/brew shellenv)" (or the Linux prefix) as the installer prints at the end.

Sources