Managing packages with Homebrew

Installing

Formulae are packages built from source (e.g. git, jq). Casks are packages distributed as native macOS installers (.dmg, .pkg) — often GUI apps like 1Password but also CLI tools like Claude Code.

Install a formula:

brew install [formula]

Install a cask:

brew install --cask [cask]

Listing

List installed packages with version numbers:

brew list --versions

List packages that are not dependencies of another (top-level installs):

brew leaves

List installed casks (not included in brew leaves):

brew list --cask

Show info about a formula:

brew info [formula]

Show dependencies for all installed formulae:

brew deps --installed

Show dependencies as a tree:

brew deps --installed --tree

Check which installed formulae depend on a given formula:

brew uses --installed [formula]

Updating

Fetch the latest Homebrew and formula definitions:

brew update

Check which installed formulae have newer versions available:

brew outdated --verbose

Upgrade all outdated formulae:

brew upgrade

Backup and Restore

Export all installed formulae, casks, and taps to a Brewfile:

brew bundle dump

Use --force to overwrite an existing Brewfile:

brew bundle dump --force

Restore from a Brewfile:

brew bundle install

Removing

Uninstall a formula and all its older versions:

brew remove --force [formula]

Cleanup

Dry run — show what cleanup would remove:

brew cleanup -ns

Remove old versions and scrub the download cache:

brew cleanup -s