2 min read

Install Homebrew

Install Homebrew, the de-facto package manager on macOS. The one-line installer, PATH setup for Apple Silicon, and how to verify it works.

Install Homebrew

Homebrew is the package manager I install before anything else on a fresh Mac. Most posts on this blog assume brew is on your PATH — this post is the prerequisite. Linux and Windows alternatives are covered at the bottom.

macOS (Apple Silicon and Intel)

The official installer is a single shell command. It writes to /opt/homebrew on Apple Silicon and /usr/local on Intel.

# install homebrew using the official one-line script

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

After the install finishes, the script prints two eval lines for shell setup. On Apple Silicon you must add brew to your PATH yourself — the installer does not do this in your shell config.

# add brew to PATH on apple silicon (zsh)

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

If you use bash, replace ~/.zprofile with ~/.bash_profile. On Intel Macs the path is /usr/local/bin/brew.

Linux

Homebrew runs on Linux too (officially supported, sometimes called Linuxbrew). Same installer, different default location: /home/linuxbrew/.linuxbrew.

# install homebrew on linux

/bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/HEAD/install.sh)"
# add brew to PATH on linux

echo 'eval "$(/home/linuxbrew/.linuxbrew/bin/brew shellenv)"' >> ~/.bashrc && eval "$(/home/linuxbrew/.linuxbrew/bin/brew shellenv)"

You'll need build-essential, procps, curl, file, and git first on Debian/Ubuntu. For most engineering work on Linux I prefer the native package manager (apt, dnf) and use brew only for tools not packaged upstream.

Windows

There is no native Homebrew for Windows. Two options:

  • WSL2 (recommended): install Ubuntu via WSL, then follow the Linux instructions inside WSL.
  • winget or Scoop: native Windows package managers. winget install <package> covers most of what you'd reach brew for.

Verify

# check that brew is on PATH and report version

brew --version

You should see something like Homebrew 4.x.x. If the command is not found, your shell did not pick up the shellenv line — open a new terminal or source ~/.zprofile.

Common gotchas

  • Apple Silicon path: Apple Silicon brew lives at /opt/homebrew, not /usr/local. If a tutorial assumes /usr/local/bin/brew, it's outdated.
  • Permissions: never sudo brew install. Brew owns its prefix; sudo will create files brew can't manage later.
  • Slow installs: brew rebuilds bottles from source if a binary isn't available for your OS version. If a fresh install is taking 20 minutes, your macOS version may be out of bottle support — upgrade macOS before fighting brew.
  • Doctor: brew doctor after install. It'll flag PATH conflicts, leftover symlinks from a prior install, and Xcode CLT issues.

Once brew --version works, you're ready to install everything else with brew install <pkg>.

Rate this article

How helpful did you find this?

Newsletter

Get new articles in your inbox

AI engineering, LLM systems, and software architecture — no filler.

No spam. Unsubscribe any time.

Discussion

Comments

Leave a note about the article, architecture choices, or what you would build next.

Comments are stored in Supabase and fetched per post slug.

Loading comments...