Homebrew - The Mac Package Manager
Homebrew is a package manager for Mac. It lets you install and manage development tools and command-line apps easily from the terminal.
Think of it as an “App Store for developers.” Just as the App Store manages apps, Homebrew manages development tools with a single command.
Why Engineers Use Homebrew
Section titled “Why Engineers Use Homebrew”On Mac, many development tools such as the latest Git, Python, and Node.js are not installed by default, so you would otherwise have to download and install them manually from official websites. Homebrew gives you several advantages:
- Installation finishes with one command - You do not have to open a browser, download files, and run
.dmginstallers - Updates are centralized -
brew upgradecan update all installed tools at once - You can see what is installed -
brew listshows installed tools, which makes migration to a new Mac easier
Installation Method
Section titled “Installation Method”Open the terminal and run the following command exactly as shown:
/bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/HEAD/install.sh)"The installer will show the steps it needs and may ask for your password. Enter your Mac login password. Nothing will appear while you type, which is normal.
Installation takes a few minutes. Do not close the terminal until it finishes.
Apple Silicon (M1/M2/M3/M4) vs Intel
Section titled “Apple Silicon (M1/M2/M3/M4) vs Intel”The Homebrew install location depends on the Mac chip.
| Mac type | Chip | Install location |
|---|---|---|
| Macs from 2020 onward (often) | Apple Silicon (M1-M4) | /opt/homebrew/ |
| Macs from before 2020 | Intel | /usr/local/ |
To check your chip, click the Apple logo in the top-left corner and choose “About This Mac.”
Path Setup for Apple Silicon Macs
Section titled “Path Setup for Apple Silicon Macs”On Apple Silicon Macs with M1 / M2 / M3 / M4 chips, you need to add a path configuration after installation. When the installer finishes, it will show something like this:
# Example instructions shown by the installer (Apple Silicon)
echo 'eval "$(/opt/homebrew/bin/brew shellenv)"' >> ~/.zprofile
eval "$(/opt/homebrew/bin/brew shellenv)"Run those commands exactly as shown. After that, open a new terminal window and Homebrew will be available.
Verifying the Installation
Section titled “Verifying the Installation”Run the following command in the terminal. If a version number appears, the installation succeeded.
brew --versionHomebrew 4.x.xHomebrew vs Downloading from the Official Website
Section titled “Homebrew vs Downloading from the Official Website”Many development tools can also be downloaded from their official websites. Use this table to decide which option makes sense.
| Comparison | Homebrew | Official site (.dmg / .pkg) |
|---|---|---|
| Installation method | One command | Download in browser + manual install |
| Updates | Update everything with brew upgrade | Update each app manually, or through the app’s auto-update feature |
| Uninstall | brew uninstall | Remove manually; settings files may remain |
| Ease of management | Centralized management | Scattered across apps |
| GUI app support | Possible with --cask | Standard method |
| Best for | CLI tools and development libraries | Commercial apps and tools that require special installers |
Recommended Use Cases
Section titled “Recommended Use Cases”Recommended to install with Homebrew (development tools and CLI tools):
git- version controlgh- GitHub CLInodeornvm- Node.js and version managementpyenv- Python version managementwget,curl- file downloadsjq- JSON processingtree- directory tree display
Better downloaded from the official website:
- Adobe Creative Cloud (requires a dedicated installer)
- 1Password (official installer with up-to-date security support)
- Special drivers or system-level tools
Fine either way (also available through Homebrew Cask):
- VS Code -
brew install --cask visual-studio-code - Google Chrome -
brew install --cask google-chrome - Slack -
brew install --cask slack - Zoom -
brew install --cask zoom
Installing these through Homebrew Cask lets you update them in bulk with brew upgrade --cask.
Common Commands
Section titled “Common Commands”brew install <package> # Install a package
brew install --cask <app> # Install a GUI app
brew uninstall <package> # Uninstall a package
brew update # Update Homebrew itself
brew upgrade # Update all packages
brew upgrade <package> # Update only one package
brew list # Show installed packages
brew list --cask # Show installed Cask apps
brew search <keyword> # Search for a package
brew info <package> # Show package information
brew doctor # Diagnose problems
brew cleanup # Remove old cached versionsExample Usage
Section titled “Example Usage”# Install git
brew install git
# Install VS Code as a Cask
brew install --cask visual-studio-code
# Check installed packages
brew list
# Update Homebrew and all packages at once
brew update && brew upgrade
# Run diagnostics to check for problems
brew doctorEssential Packages for Engineering Setups
Section titled “Essential Packages for Engineering Setups”Here are useful packages to install early when building a development environment.
| Package | Install command | Purpose |
|---|---|---|
| git | brew install git | Version control (when you want the latest version) |
| gh | brew install gh | GitHub CLI (manage pull requests and issues from the terminal) |
| nvm | brew install nvm | Node.js version management |
| pyenv | brew install pyenv | Python version management |
| wget | brew install wget | Download files from URLs |
| jq | brew install jq | Format and manipulate JSON data |
| tree | brew install tree | Show folder structures as a tree |
| VS Code | brew install --cask visual-studio-code | Code editor |
# Example of installing several development tools at once
brew install git gh nvm pyenv wget jq tree
brew install --cask visual-studio-codeGUI App Installation (Cask)
Section titled “GUI App Installation (Cask)”Homebrew can install GUI apps as well as terminal tools. Use the --cask option.
# Install VS Code
brew install --cask visual-studio-code
# Install Google Chrome
brew install --cask google-chrome
# Install Rectangle (window management app)
brew install --cask rectangleApps installed with --cask are placed in the Applications folder like normal apps and can be launched from Launchpad or Spotlight.
Common Troubleshooting
Section titled “Common Troubleshooting”brew: command not found
Section titled “brew: command not found”Homebrew is not installed or your PATH is not set.
- First check whether Homebrew is installed:
ls /opt/homebrew/bin/brew(for Apple Silicon) - If it is installed but the command is not found, you need to set the path
# For Apple Silicon Macs
echo 'eval "$(/opt/homebrew/bin/brew shellenv)"' >> ~/.zprofile
source ~/.zprofilebrew Not Found on Apple Silicon
Section titled “brew Not Found on Apple Silicon”/opt/homebrew/bin may not be on your PATH.
# Check whether the path is set
echo $PATH
# Add the path (append to ~/.zprofile)
echo 'eval "$(/opt/homebrew/bin/brew shellenv)"' >> ~/.zprofile
eval "$(/opt/homebrew/bin/brew shellenv)"Handling brew doctor Warnings
Section titled “Handling brew doctor Warnings”brew doctor diagnoses configuration problems.
brew doctorIf it prints Your system is ready to brew., everything is fine. If warnings appear, follow the instructions shown. Some warnings are harmless, so read the message carefully before deciding what to change.
Package Installation Errors
Section titled “Package Installation Errors”# First update Homebrew itself and try again
brew update
brew install <package>
# If that does not help, run diagnostics
brew doctorFrequently Asked Questions
Section titled “Frequently Asked Questions”Q: Do I need to reinstall apps I already have with Homebrew?
A: No. However, managing apps with Homebrew makes it convenient to update them all with brew upgrade, so many developers migrate. CLI tools such as git and wget especially benefit from Homebrew management.
Q: What should I do if brew install fails?
A: Run brew doctor first. Following the instructions it gives will fix many problems. If that still does not solve it, search the error message directly or check the Homebrew GitHub Issues.
Q: Can Homebrew be uninstalled?
A: Yes. The Homebrew official site has uninstall instructions.
Q: What is the difference between brew update and brew upgrade?
A: brew update refreshes Homebrew’s database of available packages. brew upgrade actually updates installed packages to newer versions. Usually you run both in order: brew update && brew upgrade.
Q: How do I check what is installed?
A: brew list shows CLI tools, and brew list --cask shows GUI apps.