The zsh: command not found: brew error means Homebrew is either not installed or its binary directory is missing from PATH. Check /opt/homebrew/bin/brew --version on Apple Silicon and /usr/local/bin/brew --version on Intel; once the binary exists, add the matching directory to your shell configuration, reload it, and verify with brew --version.
How to Fix "zsh: command not found: brew" on macOS (Intel & Apple Silicon)
Run the brew shellenv fix for Apple Silicon or Intel, resolve Rosetta conflicts, and recover Homebrew after a macOS update. Includes diagnostic commands.
// The short answer
In this guide · 6 sections
Running into zsh: command not found: brew basically means your terminal has no idea where Homebrew is hiding. You’ll usually see this right after installing it for the first time or right after updating macOS. Getting it working again is just a matter of pointing your shell to the right folder, depending on the chip inside your Mac.
Target OS: macOS
Apple Silicon Path: /opt/homebrew/bin/brew
Intel Path: /usr/local/bin/brew
Instant Diagnostic Command: /opt/homebrew/bin/brew --version
The 30-Second Diagnostic: Why is Homebrew Missing?
Run that diagnostic command above to see what state your setup is actually in:
- You see a version number → Homebrew is on your drive, but your shell can't find it. Jump straight down to Fix 1.
- You get
no file or directory→ Homebrew isn't installed at all. Run the install script below, then head to Fix 1. - The direct command works, but plain
brewstill breaks after setting PATH → Check out Fix 2 (Rosetta) or Fix 3 (macOS update).
If your Mac says no file or directory, you just need to get the files installed from scratch. Pop open your terminal and run the standard install script:
Bash
/bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/HEAD/install.sh)"Once it wraps up, don’t close the window yet - check the output. The installer always prints a little section called Next steps with the exact lines you need to run to fix your PATH. Make sure you copy and paste those right away. Almost everyone skips past that text, which is why the command fails even after a clean install.
Fix 1: Add Homebrew to Your PATH (The Right Way)
You'll see a lot of guides telling you to stitch PATH variables together by hand, but that's really easy to mess up with a typo. Homebrew has a built-in helper called brew shellenv that handles all the heavy lifting cleanly behind the scenes.
For Apple Silicon Macs (M1/M2/M3/M4)
On Apple Silicon, Homebrew keeps all its files tucked inside /opt/homebrew. Just fire up your terminal and paste these two lines in:
Bash
echo 'eval "$(/opt/homebrew/bin/brew shellenv)"' >> ~/.zprofile
eval "$(/opt/homebrew/bin/brew shellenv)"For Intel Macs
If you’re on an older Intel Mac, it uses the classic Unix folder layout instead. Your install lives over in /usr/local/bin.
Bash
echo 'eval "$(/usr/local/bin/brew shellenv)"' >> ~/.zprofile
eval "$(/usr/local/bin/brew shellenv)"Why .zprofile is Better Than .zshrc
Your .zprofile only runs once when you first open your terminal session, while .zshrc reloads every single time you open a new tab or split a pane.
Putting your environment setup in .zprofile keeps your terminal snappy when opening new windows. It saves you from running duplicate scripts that quietly slow things down over time, which is why the Homebrew team recommends sticking it there anyway.
Once you’ve pasted the commands for your chip, double-check that it took:
Bash
brew --versionIf it prints out a version number, you're good to go.
Fix 2: Resolve the Rosetta 2 Terminal Conflict
If you're on Apple Silicon, there's another sneaky thing that trips people up: running Terminal through Rosetta. Doing that forces your shell into an emulated x86_64 environment.
When that happens, your shell completely ignores the modern /opt/homebrew folder where your tools actually live. You can check this right now by typing uname -m in your prompt. If it prints out x86_64 instead of arm64, you’re running inside Rosetta without realizing it.
To fix it, open Finder, head to Applications, and open Utilities. Right-click on Terminal, choose Get Info, and make sure Open using Rosetta is turned off. Quit Terminal completely, open it back up, and you should be set.
Fix 3: Restore Homebrew After a macOS Major Update
Whenever Apple pushes a big macOS upgrade, it has a bad habit of wiping out or disconnecting the Command Line Tools. Since Homebrew relies heavily on those Xcode tools under the hood, it breaks instantly.
If brew suddenly stopped working right after updating your OS, run this command in your terminal:
Bash
xcode-select --installA prompt will pop up asking to install the developer tools - just click through, let the download finish, and restart your terminal. If brew is still acting up after that, go ahead and rerun the official Homebrew installer command. It won’t erase your installed tools; it just repairs broken symlinks and cleans up missing pieces.
Fix 4: NVM and PATH Shadowing Conflicts
Tools like Node Version Manager (NVM) can be pretty aggressive about how they rewrite your PATH. If your shell loads NVM after Homebrew, it can end up masking your brew binary altogether. You run into the exact same headache with Conda environments, which love sticking their own folders right at the front of your PATH.
Take a look inside your ~/.zprofile or ~/.zshrc file to see how things are arranged. You want the Homebrew eval line sitting right near the top, well ahead of any NVM or Conda blocks. Rearrange them so it looks like this:
Bash
# Homebrew first
eval "$(/opt/homebrew/bin/brew shellenv)"
# NVM after
export NVM_DIR="$HOME/.nvm"
[ -s "$NVM_DIR/nvm.sh" ] && \. "$NVM_DIR/nvm.sh"Save the file, then refresh your current terminal window so the changes take effect:
Bash
source ~/.zprofileGive it a quick test with brew --version to make sure it answers.
Still Failing? Run brew doctor
Homebrew actually comes with its own built-in health check called brew doctor. Even if your PATH is sorted out, weird folder permissions or broken symlinks can still get in the way.
Bash
brew doctorIt will scan your setup and give you plain-English instructions for anything it finds out of place. Just work through whatever warnings pop up before you start installing packages again - most weird post-update glitches get flagged right here.
Once you have Homebrew behaving, run brew list to see what else might need a refresh. Packages like Node.js or tools installed via pip often need a quick recheck after fixing your system environment.
Quick answers
Frequently asked questions
Why do I get zsh: command not found: brew after installing Homebrew?
The installer completed but did not update your shell's PATH. Run `eval "$(/opt/homebrew/bin/brew shellenv)"` (Apple Silicon) or `eval "$(/usr/local/bin/brew shellenv)"` (Intel) to fix it immediately, then add the same line to your ~/.zprofile to make it permanent.
What is the difference between .zshrc and .zprofile for Homebrew?
.zprofile runs once at login and is where Homebrew recommends placing its PATH configuration. .zshrc runs every time you open a new terminal tab. Both work, but .zprofile is faster and avoids redundant script execution.
What does brew shellenv do?
It outputs the correct environment variables for your Homebrew installation, including the PATH, based on your Mac architecture. Using eval with this command is more reliable than manually typing export PATH because it automatically adjusts for Apple Silicon versus Intel paths.
Why is brew not found on my M1/M2/M3 Mac?
Apple Silicon Macs install Homebrew at /opt/homebrew, which is not in the default PATH. You need to add `eval "$(/opt/homebrew/bin/brew shellenv)"` to your ~/.zprofile. Also check that Terminal is not running in Rosetta mode by running `uname -m` and ensuring it returns arm64.
How do I fix brew command not found after a macOS update?
macOS updates often remove Xcode Command Line Tools, which Homebrew depends on. Run `xcode-select --install` to reinstall them. If brew still fails, run the Homebrew installation script again as it safely repairs an existing installation.
Can NVM or Conda break my Homebrew PATH?
Yes. If NVM or Conda initializes after Homebrew in your config file, it can override the PATH and shadow the brew command. Move the Homebrew eval line to the top of your ~/.zprofile or ~/.zshrc, before any NVM or Conda blocks.
How do I check if Homebrew is actually installed?
Run `/opt/homebrew/bin/brew --version` (Apple Silicon) or `/usr/local/bin/brew --version` (Intel) using the full path. If this returns a version number, Homebrew is installed but missing from your PATH. If it returns an error, Homebrew needs to be installed.
What does brew doctor do?
It scans your system for configuration problems including incorrect permissions, broken symlinks, and missing dependencies. Run it after fixing the PATH issue to catch any remaining problems before installing packages.
Something wrong or out of date?
Tools change fast. Tell the editor what no longer works.