Homebrew guide for Mac
How to install Homebrew on macOS, how formulas differ from casks, and the commands you will use most.
Homebrew is a package manager for macOS. You use it in the terminal to install command-line tools and desktop apps.
Why use Homebrew?
Homebrew installs, updates, and removes software that the Mac App Store does not carry. It also installs the packages each one depends on.
Benefits
- One command installs or updates a package
- Dependencies install with the package
- Thousands of formulas and casks
Who uses it
- Developers
- System administrators
- People who set up Macs often
Run one command, then finish setup in three steps
System requirements
A recent macOS version on Apple Silicon or Intel, and the Xcode Command Line Tools. The installer offers to add them. Homebrew lists the supported versions in its installation docs.
Install command
The script lists what it will install and waits for you to press Return.
Post-installation setup
- 1. Add Homebrew to PATH using the commands from the installer.
- 2. Check the installation by running
brew doctor. - 3. Update Homebrew by running
brew update.
Homebrew has two kinds of packages
| Aspect | Formulas | Casks |
|---|---|---|
| What they install | Command-line tools and libraries | GUI applications |
| Installation location | /opt/homebrew/Cellar, or /usr/local/Cellar on Intel | /Applications folder |
| Install command | brew install [name] | brew install --cask [name] |
| Examples | git, node, python, wget | Chrome, Slack, VS Code, Spotify |
| Use case | Development tools and servers | Desktop and productivity apps |
Formulas install command-line tools and libraries.
Development tools
Databases and services
Common formula commands
- brew search [text] Search packages
- brew info [formula] Show details
- brew deps [formula] Show what it depends on
- brew uses [formula] Show what depends on it
Casks install macOS applications distributed as binaries.
Productivity apps
Developer tools
You can browse casks by category on FastBrew.
The commands you will use most
| Command | Description |
|---|---|
brew install [package] | Install a formula or cask |
brew uninstall [package] | Remove a package |
brew list | List all installed packages |
brew search [text] | Search for packages |
brew info [package] | Display package details |
| Command | Description |
|---|---|
brew update | Update Homebrew and formula definitions |
brew upgrade | Upgrade all outdated packages |
brew outdated | List packages with available updates |
brew cleanup | Remove old versions and clear cache |
brew doctor | Check your setup for problems |
Run the maintenance commands about once a week.
| Command | Description |
|---|---|
brew tap [user/repo] | Add third-party repositories |
brew services list | List background services |
brew pin [formula] | Prevent a formula from being upgraded |
brew leaves | List formulas not depended on by others |
brew bundle | Install packages from a Brewfile |
Fix permissions
sudo chown -R $(whoami) $(brew --prefix)/* Fix Homebrew directory ownership
Remove all caches
brew cleanup --prune=all Remove cached downloads and old versions
Reset Homebrew
brew update-reset Reset Homebrew and its taps to the latest upstream version
Do
- Run
brew updatebefore installing - Use
brew doctorwhen something breaks - Run
brew upgradeto update installed packages - Clean old versions with
brew cleanup - Use casks for GUI applications
Avoid
- Using sudo with brew commands
- Deleting formula files by hand
- Ignoring brew doctor warnings
- Installing the same tool with Homebrew and another package manager
- Installing duplicates without checking
brew list
Search the FastBrew catalog and build one install command for your Mac.