Writing

Homebrew Cheatsheet

Common commands for interacting with Homebrew, the macOS package manager

3 Apr 2026

·

2 min read

·
macOS

Share

I use Homebrew every day but still find myself looking up the same handful of commands. This is my personal reference, covering the commands I reach for most and Brewfile for keeping a new machine setup reproducible.

Commands

TaskCommand
Update package indexbrew update
Upgrade all installed packagesbrew upgrade
Upgrade a specific packagebrew upgrade <package>
Remove old versions of packagesbrew cleanup
Check for problemsbrew doctor
List installed packagesbrew list
List outdated packagesbrew outdated
List top-level installs (no dependents)brew leaves
Show what depends on a packagebrew uses --installed <pkg>
Uninstall a packagebrew uninstall <package>

brew leaves is the one I find most useful when cleaning up. It shows only packages that nothing else depends on, so you can safely remove them without breaking other installs.

Brewfile

A Brewfile lets you declare your installed packages in a text file and restore them on a new machine with a single command. I keep mine in my dotfiles so a new machine bootstrap is just running brew bundle.

# Dump currently installed packages to a Brewfile
brew bundle dump --file=~/Brewfile

# Install everything in a Brewfile
brew bundle install --file=~/Brewfile

An example Brewfile:

Brewfile
brew "git"
brew "fnm"
brew "direnv"
cask "cursor"
cask "rectangle"

brew entries are CLI tools installed to /usr/local/bin; cask entries are macOS applications. Running brew bundle dump captures everything currently installed, which makes it easy to snapshot a working setup before wiping a machine.

Continue reading