/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
| Command | Does |
|---|---|
| brew install wget | install a formula |
| brew install --cask firefox | install an app (cask) |
| brew uninstall wget | remove it |
| brew autoremove | remove dependencies nothing needs any more |
| brew search postgres | find formulae and casks |
| brew info node | versions, dependencies, caveats |
Update
| Command | Does |
|---|---|
| brew update | update Homebrew and the package index |
| brew outdated | list packages with newer versions |
| brew upgrade [name] | upgrade everything, or one package |
| brew pin node | keep node at its current version during upgrade |
| brew cleanup | delete old versions and cached downloads |
| brew doctor | diagnose common problems |
Versions and services
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 LinuxReproduce a machine with a Brewfile
brew "git"
brew "node"
cask "visual-studio-code"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
Related pages
flags · wingetwinget install --silent --accept-package-agreements: unattended installsInstall Windows apps without prompts: winget install --id Git.Git -e --silent --accept-package-agreements --accept-source-agreements in setup scripts.commands · aptList installed packages with apt and dpkgList installed packages on Debian and Ubuntu with apt list --installed, show manually installed ones with apt-mark showmanual, and export the list to reuse.compat · dnfdnf 4 vs dnf5: which Fedora and RHEL releases use whichFedora 41 replaced dnf 4 with dnf5, a C++ rewrite that keeps the dnf command; RHEL 9 and 10 still use dnf 4. Command differences and what breaks scripts.