You installed Homebrew, but when you type brew, you get:

zsh: command not found: brew

This is the most common Homebrew problem. It happens because your Mac doesn't know where to find the brew command yet.

Here's the fix.

The Quick Fix

Run this command:

On Apple Silicon Macs (M1, M2, M3, M4):

eval "\$(/opt/homebrew/bin/brew shellenv)"

On Intel Macs:

eval "\$(/usr/local/bin/brew shellenv)"

Now try brew again. It should work.

But this only lasts until you close Terminal. To make it permanent, keep reading.

The Permanent Fix

You need to add Homebrew to your shell configuration so it loads every time you open Terminal.

Step 1: Open your shell config file

nano ~/.zshrc

Step 2: Add this line at the bottom

Apple Silicon Macs:

eval "\$(/opt/homebrew/bin/brew shellenv)"

Intel Macs:

eval "\$(/usr/local/bin/brew shellenv)"

Step 3: Save and exit

Press Control + O, then Enter to save. Press Control + X to exit.

Step 4: Reload the config

source ~/.zshrc

Done. The brew command will work in every new Terminal window from now on.

Not Sure If You Have Apple Silicon or Intel?

Click the Apple menu → About This Mac.

  • If it says "Chip: Apple M1" (or M2, M3, M4), you have Apple Silicon
  • If it says "Processor: Intel...", you have Intel

Or just run this:

uname -m
  • arm64 = Apple Silicon
  • x86_64 = Intel

Why This Happens

When you type a command, your Mac searches a list of folders called the PATH. If the program isn't in one of those folders, you get "command not found."

Homebrew installs to:

  • /opt/homebrew/bin on Apple Silicon Macs
  • /usr/local/bin on Intel Macs

By default, this folder isn't in your PATH. The eval command above adds it.

"I Did All That and It Still Doesn't Work"

Check if Homebrew is actually installed

Run this:

ls /opt/homebrew/bin/brew

Or for Intel:

ls /usr/local/bin/brew

If you get "No such file or directory," Homebrew isn't installed. Install it:

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

Important: After the installer finishes, it shows you commands to run. Actually run them. Most people skip this step.

Check if your .zshrc file was saved correctly

cat ~/.zshrc

Look for the eval line. If it's not there, add it again.

Make sure you're using zsh

echo \$SHELL

If this shows /bin/bash instead of /bin/zsh, you're using the old shell. The config file would be ~/.bash_profile instead of ~/.zshrc. But on modern Macs, you should switch to zsh:

chsh -s /bin/zsh

Then restart Terminal and follow the steps above.

If You Just Want It to Work Right Now

Sometimes you just need to install something and don't want to debug PATH issues. You can call brew directly with its full path:

Apple Silicon:

/opt/homebrew/bin/brew install something

Intel:

/usr/local/bin/brew install something

This works without fixing your PATH. But you should still do the permanent fix eventually.


Keep Learning

PATH issues are confusing the first time, but once you understand how your Mac finds commands, you'll fix these problems in seconds.

If you want to understand Terminal from the ground up, check out the free course at Mac Terminal for Humans.