zsh: command not found: brew 🍏 macOS

macOS: zsh: command not found: brew (Homebrew not on PATH on Apple Silicon)

Homebrew is installed in /opt/homebrew on Apple Silicon Macs, which isn’t on PATH until you add its shellenv line.

Seen on: macOS

Meaning

The installer prints “Next steps” to add brew to ~/.zprofile; skipping it (or using bash/fish) leaves brew and installed tools unavailable. Intel Macs use /usr/local.

Common causes

  • Homebrew installed but shellenv not added to ~/.zprofile
  • New terminal/shell not reloaded
  • Homebrew not installed at all

⚡ Quick fix

  1. Add eval "$(/opt/homebrew/bin/brew shellenv)" to ~/.zprofile
  2. Open a new terminal (or source the file)
  3. Install Homebrew if /opt/homebrew/bin/brew doesn’t exist

Detailed fix by platform

Shell

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

How to diagnose

  1. Path — ls /opt/homebrew/bin/brew
  2. Shell — echo $SHELL and profile file

🔧 Still not fixed?

Many errors look alike. If the steps above didn’t solve it, one of these is probably what you’re facing:

🧠 Still stuck? Analyze your error

Paste the full message, response headers or stack trace — we'll detect the platform and point to the most likely cause.