Blog
3 min read

What Is Homebrew? The Mac Package Manager Explained

Homebrew is the most popular way to install developer tools on macOS (and Linux) from the terminal. How to install it, the commands you'll use (install, upgrade, cleanup, services), formulae vs casks, where it puts things on Apple Silicon, and fixes for 'brew: command not found'.

Homebrew is a package manager for macOS (it also runs on Linux). It installs command-line tools and apps with a single command, keeps them updated, and removes them cleanly — instead of downloading installers from websites one by one.

brew install git node postgresql@18

Its tagline is "the missing package manager for macOS". (What is a CLI?)

Installing Homebrew

Open Terminal and run the install command shown on brew.sh (copy it from there, not from a random tutorial). It may ask for your password and install Apple's Command Line Tools.

On Apple Silicon Macs (M1 and later), Homebrew lives in /opt/homebrew. At the end, the installer prints two commands to add it to your PATH — run them. If you skip this, you'll get brew: command not found.

They look like:

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

On Intel Macs it uses /usr/local, which is usually already on your PATH. (Command not found and the PATH variable)

Formulae and casks

  • Formulae — command-line tools and libraries: git, node, python, postgresql, ffmpeg.
  • Casks — regular Mac apps: brew install --cask visual-studio-code, --cask docker, --cask google-chrome.

The commands you'll use

brew search postgres        # find packages
brew info node              # details and versions
brew install node           # install
brew list                   # what's installed
brew update                 # update Homebrew's package list
brew upgrade                # upgrade everything installed
brew upgrade node           # upgrade one thing
brew uninstall node         # remove
brew cleanup                # delete old versions to free disk space
brew doctor                 # diagnose problems

Running background services

Databases and similar tools can run in the background:

brew services start postgresql@18
brew services list
brew services stop postgresql@18

Handy for local development — though if your project uses Docker Compose, its database runs there instead. Running both on port 5432 causes conflicts. (Docker port already allocated)

Versions

Some tools have versioned formulae (postgresql@17, python@3.13). For languages where projects need different versions, a version manager is usually better than Homebrew alone — nvm/fnm for Node, uv or pyenv for Python. (npm EACCES errors, Python virtual environments)

Homebrew and Claude Code

Claude Code can be installed with Homebrew (brew install --cask claude-code), but Homebrew installs don't update automatically — you run brew upgrade yourself. (How to update Claude Code)

Common problems

  • brew: command not found — the PATH lines weren't added. Run the shellenv commands above and open a new terminal.
  • Permission errors in /usr/local (Intel Macs) — often from earlier sudo installs; brew doctor explains how to fix ownership. Never run brew with sudo.
  • Disk filling up — run brew cleanup now and then.
  • A tool still uses the old version — another copy earlier on your PATH; check with which -a <tool>.

On Windows and Linux

  • Linux — Homebrew works on Linux too, though most people use the system package manager (apt, dnf).
  • Windows — the equivalents are WinGet (built in), Scoop and Chocolatey.

EasySpawn gives you a cloud server with the common developer tools already installed, so your project's setup isn't tied to what's on your Mac. See how it works or join the waitlist.

Related: What Is a CLI? · "Command Not Found" and the PATH Variable · The Terminal for Complete Beginners · zsh vs bash

Keep reading