gray and black laptop computer on surface

Claude Code Command Not Found? How to Fix Your PATH

You ran the Claude Code installer, it said everything worked, and then the terminal tells you zsh: command not found: claude. On Linux it’s bash: claude: command not found, and on Windows it’s 'claude' is not recognized as an internal or external command. This is the classic Claude Code command not found problem, and in almost every case the program is installed fine. Your shell just doesn’t know where to look for it. Here’s how to fix that, and the other causes worth ruling out.

Where the installer puts claude

The native installer, the one you run with this command on macOS and Linux:

curl -fsSL https://claude.ai/install.sh | bash

places the claude program at ~/.local/bin/claude. On Windows it goes to %USERPROFILE%\.local\bin\claude.exe. If that folder isn’t in your PATH, the shell can’t find it. The installer spots this and prints a note under Setup notes: saying Native installation exists but ~/.local/bin is not in your PATH., but it doesn’t change your PATH for you. That note is easy to miss in the output.

Step 1: check the binary is there

On macOS or Linux:

ls -la ~/.local/bin/claude

If you get a file listing, the install worked and you only need to fix your PATH. If you get No such file or directory, there’s no native install. Either run the installer again, or, if you installed another way (npm, Homebrew, WinGet), skip to the section on duplicate installs below.

One common trap: the VS Code extension bundles its own private copy of Claude Code for the chat panel and doesn’t put claude on your PATH. If you’ve only installed the extension, the command won’t exist in your terminal until you run the standalone installer.

Step 2: add ~/.local/bin to your PATH

First check whether the folder is already there:

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

If that prints nothing, add it to your shell’s config file. For Zsh, the default shell on macOS:

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

For Bash on Linux:

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

For Bash on macOS, use ~/.bash_profile instead of ~/.bashrc. Terminal on macOS starts Bash as a login shell, which doesn’t read ~/.bashrc. If you use fish or another shell, add ~/.local/bin with that shell’s own syntax.

Then check it worked:

claude --version

Step 2 on Windows

In PowerShell, check the file exists and whether its folder is on your PATH:

Test-Path "$env:USERPROFILE\.local\bin\claude.exe"
$env:PATH -split ';' | Select-String '\.local\\bin'

If the file exists but the second command prints nothing, add the folder to your user PATH:

$currentPath = [Environment]::GetEnvironmentVariable('PATH', 'User')
[Environment]::SetEnvironmentVariable('PATH', "$currentPath;$env:USERPROFILE\.local\bin", 'User')

Close and reopen the terminal, then run claude --version.

Still not found? Three things to check

  • The terminal is older than the change. A window that was already open keeps its old PATH. A terminal inside VS Code, Cursor or another editor takes its PATH from the editor, so quit and reopen the whole editor, not just the terminal tab.
  • The line went into the wrong file. Run echo $0 to see which shell you’re actually using, then add the PATH line to that shell’s config.
  • The line wasn’t saved. Run grep -n '.local/bin' ~/.zshrc (or your shell’s file). If it prints nothing, add the line again. If the echo command said permission denied, your config file is owned by another user or read-only; fix it with sudo chown $(whoami) ~/.zshrc or chmod u+w ~/.zshrc.

Duplicate installs fighting each other

If you’ve installed Claude Code more than once over the past year, you might have an old npm copy, a Homebrew copy and a native copy all on the same machine. That can give you a missing command, an old version, or a version that doesn’t match what claude doctor reports. List every claude on your PATH:

which -a claude

And check the usual locations:

ls -la ~/.local/bin/claude         # native installer
ls -la ~/.claude/local/            # legacy local npm install
npm -g ls @anthropic-ai/claude-code 2>/dev/null   # global npm install

Keep one. The native install at ~/.local/bin/claude is the one Anthropic recommends. Remove the others:

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

On Windows, where.exe claude lists every copy, and winget uninstall Anthropic.ClaudeCode removes a WinGet install.

Let claude doctor check the rest

Once claude runs at all, use the built-in health check. From your shell:

claude doctor

Or type /doctor inside a running session. It checks your installation, settings and extensions, and offers to apply fixes it finds. If Claude Code starts but then crashes or hangs, run ls -la "$(command -v claude)" to confirm the binary is the one you expect, and on Linux ldd "$(command -v claude)" | grep "not found" to spot missing system libraries.

Once it’s working

With the command sorted, it’s worth setting a few things up before your first real session. Claude Code permission modes explains plan mode and allow rules, Is Claude Code safe? covers the risks and how to lock it down, and Claude Code usage limit reached has habits that make your plan’s allowance last.


Leave a Reply