brew install <formula>for CLI tools ·brew install --cask <app>for GUI appsbrew update && brew upgradekeeps everything current — run weeklybrew bundleuses aBrewfileto share your entire setup with a team or new machinebrew doctordiagnoses problems — always run it first when something breaksbrew servicesmanages background daemons (PostgreSQL, Redis, nginx) without root
Install Homebrew
/bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/HEAD/install.sh)" After installing on Apple Silicon (M-series Mac), add Homebrew to your PATH:
echo 'eval "$(/opt/homebrew/bin/brew shellenv)"' >> ~/.zprofile
eval "$(/opt/homebrew/bin/brew shellenv)" On Intel Mac, Homebrew installs to /usr/local (already in PATH). On Apple Silicon it installs to /opt/homebrew.
Quick reference tables
Essential daily commands
| Command | What it does |
|---|---|
brew install <formula> | Install a CLI tool or library |
brew install --cask <app> | Install a GUI application |
brew uninstall <formula> | Remove a package |
brew upgrade | Upgrade all installed packages |
brew upgrade <formula> | Upgrade a specific package |
brew update | Update Homebrew itself and all taps |
brew list | List all installed formulae |
brew list --cask | List all installed cask apps |
brew info <formula> | Show version, dependencies, and install path |
brew search <query> | Search formulae and casks |
brew doctor | Check for problems |
brew cleanup | Remove old versions and cached downloads |
brew outdated | Show packages with newer versions available |
brew help | Show help |
Cask-specific commands
| Command | What it does |
|---|---|
brew install --cask firefox | Install Firefox |
brew uninstall --cask firefox | Uninstall Firefox |
brew upgrade --cask | Upgrade all cask apps |
brew upgrade --cask firefox | Upgrade a specific cask |
brew list --cask | List installed casks |
brew info --cask rectangle | Show cask info |
Installing packages
Formulae (CLI tools)
brew install git
brew install node
brew install python@3.12 # Specific version
brew install postgresql@16 # Versioned formula
brew install ffmpeg
brew install uv # Python package manager
brew install gh # GitHub CLI
brew install ripgrep # Fast grep (rg)
brew install fzf # Fuzzy finder
brew install bat # Better cat
brew install eza # Modern ls replacement
brew install jq # JSON processor
brew install httpie # HTTP client
brew install tmux
brew install neovim Casks (GUI apps)
brew install --cask visual-studio-code
brew install --cask cursor # AI code editor
brew install --cask iterm2
brew install --cask warp # AI terminal
brew install --cask rectangle # Window manager
brew install --cask raycast # Spotlight replacement
brew install --cask docker
brew install --cask figma
brew install --cask postman
brew install --cask obsidian
brew install --cask 1password
brew install --cask cleanmymac # System cleaner Searching and discovering packages
brew search postgres # Search by name
brew search /^node/ # Regex search (formulae starting with "node")
brew info node # Show details, versions, installed status
brew info --cask visual-studio-code # Cask details
# Open the formula homepage
brew home node
brew home --cask figma Updating and upgrading
# Update Homebrew's index of packages (no upgrades)
brew update
# See what can be upgraded
brew outdated
brew outdated --cask
# Upgrade everything
brew update && brew upgrade && brew upgrade --cask
# Upgrade one package
brew upgrade node
# Upgrade one cask
brew upgrade --cask rectangle
# Cleanup old versions after upgrading
brew cleanup # Removes versions older than 120 days
brew cleanup -n # Dry run — show what would be deleted
brew cleanup --prune=30 # Remove files older than 30 days Pinning versions
Pin a formula to prevent it from being upgraded:
brew pin postgresql@16 # Lock this version
brew unpin postgresql@16 # Allow upgrades again
brew list --pinned # Show all pinned packages brew pin prevents upgrade but doesn’t let you install a specific version. For running two versions side by side (e.g., Node 18 and Node 20), use versioned formulae: brew install node@18 node@20 and switch with brew link --overwrite node@20.
Services (background daemons)
Homebrew Services manages launchd agents — no need for sudo or manual plist files:
brew services list # Show all services and their status
brew services start postgresql # Start a service (runs on login too)
brew services stop postgresql # Stop a service
brew services restart postgresql # Restart a service
brew services run postgresql # Start once — not on login
# Run as root (when service needs privileged ports like 80/443)
sudo brew services start nginx Common services
| Formula | What it runs |
|---|---|
postgresql@16 | PostgreSQL database |
redis | Redis cache |
mysql | MySQL database |
nginx | nginx web server |
dnsmasq | Local DNS resolver |
mailhog | Local email testing |
minio | Local S3-compatible storage |
Taps — third-party repositories
Taps add extra formulae from other GitHub repos:
brew tap <user/repo> # Add a tap
brew untap <user/repo> # Remove a tap
brew tap # List all taps
# Common taps
brew tap homebrew/cask-fonts # Fonts (Nerd Fonts, etc.)
brew install --cask font-jetbrains-mono-nerd-font
brew tap nikitabobko/tap # AeroSpace window manager
brew install --cask nikitabobko/tap/aerospace
brew tap oven-sh/bun # Bun runtime
brew install bun Brewfile — share your setup
A Brewfile is a manifest of everything Homebrew manages. Commit it to your dotfiles repo to reproduce your setup on any machine.
Generate a Brewfile from current install
brew bundle dump # Creates Brewfile in current directory
brew bundle dump --force # Overwrite an existing Brewfile
brew bundle dump --file=~/.dotfiles/Brewfile # Custom location Example Brewfile
tap "homebrew/bundle"
tap "nikitabobko/tap"
# CLI tools
brew "git"
brew "node"
brew "python@3.12"
brew "uv"
brew "gh"
brew "ripgrep"
brew "fzf"
brew "bat"
brew "eza"
brew "jq"
brew "tmux"
brew "neovim"
brew "ffmpeg"
brew "postgresql@16"
brew "redis"
# GUI Apps
cask "cursor"
cask "iterm2"
cask "rectangle"
cask "raycast"
cask "docker"
cask "figma"
cask "obsidian"
cask "1password"
# Fonts
cask "font-jetbrains-mono-nerd-font"
cask "font-inter" Install from Brewfile
brew bundle # Install from ./Brewfile
brew bundle --file=~/.dotfiles/Brewfile # Install from specific path
brew bundle check # Check if everything is installed
brew bundle cleanup # Uninstall packages not in Brewfile Troubleshooting
Run doctor first
brew doctor # Prints warnings and fix suggestions
brew missing # Check for missing dependencies Common fixes
# Fix permissions
sudo chown -R $(whoami) /opt/homebrew # Apple Silicon
sudo chown -R $(whoami) /usr/local # Intel
# Reinstall a broken formula
brew reinstall node
# Clear cache when downloads fail
brew cleanup --prune=all
rm -rf $(brew --cache)
# Link a keg-only formula to PATH
brew link --overwrite node@20
# Unlink a formula (stops it from being in PATH)
brew unlink node@18
# Check where a formula is installed
brew --prefix node # e.g. /opt/homebrew/opt/node
# Show all files installed by a formula
brew list node PATH issues on Apple Silicon
If brew commands are not found after install:
# Add to ~/.zshrc (zsh) or ~/.bash_profile (bash)
export PATH="/opt/homebrew/bin:$PATH"
eval "$(/opt/homebrew/bin/brew shellenv)" Then restart your terminal or source ~/.zshrc.
Key paths
| Path | Contents |
|---|---|
/opt/homebrew | Homebrew root (Apple Silicon) |
/usr/local | Homebrew root (Intel) |
$(brew --prefix) | Homebrew root (dynamic) |
$(brew --prefix)/bin | All formula binaries |
$(brew --prefix)/Cellar | Installed formula versions |
$(brew --prefix)/Caskroom | Installed cask apps |
$(brew --prefix)/opt/<name> | Latest linked version of a formula |
$(brew --cache) | Downloaded packages cache |
Summary
brew installfor CLI tools,brew install --caskfor GUI appsbrew update && brew upgradeonce a week keeps your tools current and secure- Use
brew servicesfor database and server daemons — no plist editing required - A committed
Brewfileis the fastest way to set up a new Mac identically brew doctoris always the first step when something misbehaves
FAQ
Does Homebrew work on Linux?
Yes — Homebrew works on Linux (called Linuxbrew). It installs to ~/.linuxbrew or /home/linuxbrew/.linuxbrew. Casks are not available on Linux, but formulae work well for developer tools. For Linux servers, your distro’s package manager is usually a better fit.
How is Homebrew different from MacPorts?
Homebrew installs packages into its own prefix and creates symlinks to /usr/local (Intel) or /opt/homebrew (Apple Silicon). MacPorts installs everything under /opt/local and can conflict less with system packages, but has a smaller package selection. Homebrew is used by the overwhelming majority of macOS developers.
Can I use Homebrew alongside system Python or Node?
Yes. Homebrew-installed tools are prefixed separately. Use brew install python@3.12 and reference it as /opt/homebrew/opt/python@3.12/bin/python3. Tools like uv and nvm manage runtime versions independently — Homebrew just installs the base runtime.
Why does brew upgrade sometimes break things?
Some formulae have breaking changes between major versions. Pin the formula (brew pin <formula>) before upgrading if you’re not ready for the change. Use brew info <formula> to read the caveats before upgrading.
Is Homebrew safe? Does it require root?
Homebrew is designed to not require sudo for formula installs. Running brew install as root is discouraged and will warn you. Casks may request your password to move apps to /Applications, which is a standard macOS security prompt — not a Homebrew security issue.
What to read next
- macOS Shortcuts Cheat Sheet — system-level shortcuts to pair with your CLI setup
- tmux Cheat Sheet — installed via Homebrew, essential for terminal multiplexing
- uv Cheat Sheet — install uv via Homebrew, replace your entire Python toolchain
Related Articles
Deepen your understanding with these curated continuations.
tmux Cheat Sheet: Sessions, Panes, Windows & Config
Complete tmux reference — prefix key, sessions, windows, panes, copy mode, key bindings, plugins, and a starter .tmux.conf for 2026.
mise Cheat Sheet: Unified Runtime & Tool Manager (2026)
Complete mise reference — install and switch Node, Python, Rust, Go versions, manage tools, activate via shell, Docker, and CI/CD with working commands.
FFmpeg Cheat Sheet: Convert, Compress & Edit Video
Task-first FFmpeg reference — convert formats, compress for web, trim clips, extract audio, create GIFs, and batch-process video with working commands.