Skip to content
X

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.

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 .dmg installers
  • Updates are centralized - brew upgrade can update all installed tools at once
  • You can see what is installed - brew list shows installed tools, which makes migration to a new Mac easier

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.

The Homebrew install location depends on the Mac chip.

Mac typeChipInstall location
Macs from 2020 onward (often)Apple Silicon (M1-M4)/opt/homebrew/
Macs from before 2020Intel/usr/local/

To check your chip, click the Apple logo in the top-left corner and choose “About This Mac.”

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.

Run the following command in the terminal. If a version number appears, the installation succeeded.

brew --version
Homebrew 4.x.x

Homebrew 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.

ComparisonHomebrewOfficial site (.dmg / .pkg)
Installation methodOne commandDownload in browser + manual install
UpdatesUpdate everything with brew upgradeUpdate each app manually, or through the app’s auto-update feature
Uninstallbrew uninstallRemove manually; settings files may remain
Ease of managementCentralized managementScattered across apps
GUI app supportPossible with --caskStandard method
Best forCLI tools and development librariesCommercial apps and tools that require special installers

Recommended to install with Homebrew (development tools and CLI tools):

  • git - version control
  • gh - GitHub CLI
  • node or nvm - Node.js and version management
  • pyenv - Python version management
  • wget, curl - file downloads
  • jq - JSON processing
  • tree - 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.

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 versions
# 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 doctor

Here are useful packages to install early when building a development environment.

PackageInstall commandPurpose
gitbrew install gitVersion control (when you want the latest version)
ghbrew install ghGitHub CLI (manage pull requests and issues from the terminal)
nvmbrew install nvmNode.js version management
pyenvbrew install pyenvPython version management
wgetbrew install wgetDownload files from URLs
jqbrew install jqFormat and manipulate JSON data
treebrew install treeShow folder structures as a tree
VS Codebrew install --cask visual-studio-codeCode editor
# Example of installing several development tools at once
brew install git gh nvm pyenv wget jq tree
brew install --cask visual-studio-code

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 rectangle

Apps installed with --cask are placed in the Applications folder like normal apps and can be launched from Launchpad or Spotlight.

Homebrew is not installed or your PATH is not set.

  1. First check whether Homebrew is installed: ls /opt/homebrew/bin/brew (for Apple Silicon)
  2. 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 ~/.zprofile

/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)"

brew doctor diagnoses configuration problems.

brew doctor

If 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.

# First update Homebrew itself and try again
brew update
brew install <package>

# If that does not help, run diagnostics
brew doctor

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.