BugMedic

Homebrew “brew: command not found”: finish the PATH setup

Add the brew shellenv line to your shell config and restart the terminal.

By BugMedic editorial teamLast source review: 2026-10-03macOS, Linux

Add eval "$(/opt/homebrew/bin/brew shellenv)" to your shell config (use /usr/local/bin/brew on Intel Macs, /home/linuxbrew/.linuxbrew on Linux), then open a new terminal. Verify with brew --version.

Try these fixes in order

01

Locate your Homebrew prefix

Confirm the prefix and that brew exists there. Apple Silicon: /opt/homebrew. Intel: /usr/local. Linux: /home/linuxbrew/.linuxbrew.

ls /opt/homebrew/bin/brew
02

Add the shellenv line

This sets PATH, MANPATH, and INFOPATH for the prefix. Use the prefix that matched in step 1.

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

Start a fresh shell

Config changes only apply to new sessions.

exec zsh -l
04

Verify brew resolves

This should print the Homebrew version. If it still fails, echo $PATH and confirm the prefix bin is listed.

brew --version

Interpret what you see

Fresh install, brew never worked

What it suggests: The official installer prints post-install directions including eval "$(/opt/homebrew/bin/brew shellenv)"; skipping them leaves brew unreachable.

Next check: Add the shellenv line for your prefix to ~/.zprofile (zsh) or ~/.bash_profile (bash).

Migrated from an Intel Mac or followed a guide for the wrong chip

What it suggests: Apple Silicon uses /opt/homebrew while Intel Macs use /usr/local; the shellenv line must match the actual prefix.

Next check: Run ls on the prefix's bin/brew to find the real one, then use it in the shellenv line.

You just edited the config file

What it suggests: Shell config edits only apply to new sessions; old terminals keep the old PATH.

Next check: Open a brand-new terminal window and run brew --version.

Why this happens

  • The post-install shellenv step was skipped, so brew's bin directory is not on PATH.
  • The shellenv line was added to the wrong shell config file or the terminal was never restarted.

Still not working?

Do not reinstall Homebrew to fix this; a reinstall cannot add the PATH entry either and just wastes time. The installer already printed the exact shellenv line you need.

Official sources

These steps are based on the linked documentation and general diagnostics. BugMedic has not independently tested every product and system configuration. Review commands before running them.

Related Homebrew guides