← all posts

zsh: command not found: claude on Mac, fixed

You ran the installer, it finished without complaining, and then:

zsh: command not found: claude

Claude Code is almost certainly on your Mac. Your shell just can’t find it. On macOS that comes down to five causes, and you can rule each one out in under a minute. Work through them in order. The first two cover most cases.

First, find out what you actually have

Run these three commands. They tell you where claude is installed, if it’s installed at all, before you change anything:

ls -la ~/.local/bin/claude
which -a claude
echo $SHELL

Cause 1: the install folder isn’t on your PATH

This is the most common one by a distance. The native installer, the curl -fsSL https://claude.ai/install.sh | bash one, puts the claude command in ~/.local/bin. Plenty of Macs don’t have that folder on their PATH, so the shell never looks there.

The installer knows this happens. If you scroll back through its output, you’ll often find a line under Setup notes saying the native installation exists but ~/.local/bin isn’t in your PATH. It tells you the fix, but it doesn’t change your PATH for you.

Check whether the folder is on your PATH:

echo $PATH | tr ':' '\n' | grep -Fx "$HOME/.local/bin"

If that prints the folder, skip to cause 2. If it prints nothing, add the folder, using the file for your shell.

zsh (the default):

echo 'export PATH="$HOME/.local/bin:$PATH"' >> ~/.zshrc
source ~/.zshrc

bash on a Mac: use ~/.bash_profile, not ~/.bashrc.

echo 'export PATH="$HOME/.local/bin:$PATH"' >> ~/.bash_profile
source ~/.bash_profile

That bash detail catches a lot of people, because most Linux guides tell you ~/.bashrc. On macOS, Terminal starts bash as a login shell. A login shell skips ~/.bashrc and reads only the first of ~/.bash_profile, ~/.bash_login or ~/.profile that exists. If you already have a ~/.bash_login or ~/.profile and no ~/.bash_profile, add the line to the one you have instead of creating a new file.

Then check it worked:

claude --version

You should see a version number followed by (Claude Code).

If the echo command said permission denied, your user can’t write to your own shell config file, which usually means a past sudo left it owned by root. Check with ls -l ~/.zshrc. If the owner is root, take it back with sudo chown $(whoami) ~/.zshrc. If the owner is you, the file is read-only. Fix that with chmod u+w ~/.zshrc. Then run the two commands again.

Cause 2: the terminal you’re typing in is older than the fix

A terminal window reads your shell config once, when it opens. Every window that was already open when you installed still has the old PATH, and it’ll keep saying command not found no matter what you fix.

Cause 3: you used Homebrew and Homebrew isn’t on your PATH

If ls ~/.local/bin/claude found nothing because you installed with brew install --cask claude-code, the claude command lives in Homebrew’s folder. On Apple Silicon that’s /opt/homebrew/bin, which isn’t on a default PATH either. A sign this is your problem is that brew itself also says command not found.

Homebrew’s own installer prints the fix at the end, and it’s easy to miss. For zsh on Apple Silicon:

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

Two other Homebrew details are worth knowing:

Cause 4: you installed with npm, and npm moved

The npm package (npm install -g @anthropic-ai/claude-code) puts claude in npm’s global bin folder. Two things commonly make it disappear:

Anthropic recommends the native installer over npm for most people, and both problems are reasons why. If npm is fighting you, switching is the simplest fix. Remove the npm copy first so they don’t compete:

npm uninstall -g @anthropic-ai/claude-code
curl -fsSL https://claude.ai/install.sh | bash

Then go back to cause 1, because the native install puts the command in ~/.local/bin.

Don’t use sudo npm install -g. It creates root-owned files that cause permission errors later, and Anthropic’s docs warn against it specifically.

Cause 5: two installs, and the wrong one wins

This shows up as something other than command not found: claude runs, but it’s an old version, or claude update says it updated and nothing changed. which -a claude will list more than one path.

There are four places a claude can come from:

Location Comes from
~/.local/bin/claude The native installer (recommended)
/opt/homebrew/bin/claude Homebrew
npm’s global bin folder npm install -g
~/.claude/local/ An old local npm install from early Claude Code versions

Keep one and remove the rest. For the extras:

npm uninstall -g @anthropic-ai/claude-code
rm -rf ~/.claude/local
brew uninstall --cask claude-code

Only run the lines for installs you actually want gone. Then open a new window and check which -a claude lists a single path.

Still stuck?

Once claude --version works at all, run:

claude doctor

It checks your install, your settings files, and whether auto-update is working, and suggests fixes. It can’t help while the shell can’t find claude in the first place, which is why the causes above come first.

Two less common problems on a Mac:

Works in Terminal, not in an app?

There’s one last version of this problem. claude works fine in Terminal, but an app that runs Claude Code for you says it can’t find it.

That’s because apps you open from the Dock or Finder don’t read your .zshrc. They start with macOS’s minimal default PATH, which includes neither ~/.local/bin nor /opt/homebrew/bin. A well-behaved app checks the usual install locations itself or lets you set the path. If yours doesn’t, which claude in Terminal gives you the full path to paste in.

That’s the problem every Claude Code GUI has to solve, including Minnie, the desktop pet we make that runs Claude Code, Gemini CLI or Codex and lets you talk to it out loud. If you’ve just got claude working and want to know what to do next, Install Claude Code on your Mac picks up from your first session, and Claude Code has no GUI. Here is what people use covers the apps that put an interface on it.