Homebrew

macOS package manager - install CLI tools and apps with one command, manage dependencies automatically

TL;DR

What: The missing package manager for macOS (and Linux).

Why: Install software with one command, manage dependencies automatically.

Quick Start

Install Homebrew:

/bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/HEAD/install.sh)"

Add to PATH (Apple Silicon Mac):

echo 'eval "$(/opt/homebrew/bin/brew shellenv)"' >> ~/.zprofile
eval "$(/opt/homebrew/bin/brew shellenv)"

Verify installation:

brew --version

Install a package:

brew install wget
brew install git
brew install node

Install GUI apps (Casks):

brew install --cask visual-studio-code
brew install --cask google-chrome
brew install --cask docker

Cheatsheet

CommandDescription
brew install pkgInstall a package
brew uninstall pkgRemove a package
brew upgradeUpgrade all packages
brew upgrade pkgUpgrade specific package
brew updateUpdate Homebrew itself
brew listList installed packages
brew search textSearch for packages
brew info pkgPackage information
brew doctorDiagnose issues
brew cleanupRemove old versions
brew services listList background services
brew services start pkgStart a service

Gotchas

Command not found after install

# Add to PATH (check your shell)
# For zsh (default on macOS):
echo 'eval "$(/opt/homebrew/bin/brew shellenv)"' >> ~/.zprofile

# For bash:
echo 'eval "$(/opt/homebrew/bin/brew shellenv)"' >> ~/.bash_profile

# Then reload:
source ~/.zprofile  # or ~/.bash_profile

Permission errors

# Fix Homebrew directory permissions
sudo chown -R $(whoami) /opt/homebrew

# Or for Intel Mac:
sudo chown -R $(whoami) /usr/local/Homebrew

Package conflicts

# Unlink conflicting package
brew unlink pkg

# Link the one you want
brew link pkg

# Force link if needed
brew link --overwrite pkg

Brew doctor warnings

# Run diagnostics
brew doctor

# Usually safe to ignore warning about unlinked kegs
# Fix issues as suggested by the output

Next Steps