Fix “command not found: claude” after installing Claude Code

You ran the installer, it said it was done, and then the terminal answered command not found: claude. Almost always the program is on your disk but its folder is not on your PATH, the list of places your shell looks for commands. Here is how to check that, fix it once, and rule out the other usual causes.

What the error looks like

Same cause, different wording. If it started right after Claude Code updated itself on Windows, jump to the missing claude.exe section.

Where the installer puts it

As we read the docs, the native installer places the program at ~/.local/bin/claude on macOS and Linux, and at %USERPROFILE%\.local\bin\claude.exe on Windows. When that folder is not on your PATH, the installer says so under Setup notes: at the end of its output. It prints the fix there, but it does not change your PATH for you, so it is easy to miss.

One trap: the VS Code extension keeps its own private copy of the program for its chat panel and does not put claude on your PATH. If you only installed the extension, there is nothing at that path. Run the standalone install to use claude in a terminal.

Step 1: is the file there?

macOS or Linux:

ls -la ~/.local/bin/claude

Windows PowerShell:

Test-Path "$env:USERPROFILE\.local\bin\claude.exe"

Windows CMD:

dir "%USERPROFILE%\.local\bin\claude.exe"

Step 2: is its folder on your PATH?

macOS or Linux:

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

Windows PowerShell:

$env:PATH -split ';' | Select-String '\.local\\bin'

Windows CMD:

echo %PATH% | findstr /i "local\bin"

If it prints the folder, the PATH is fine and you can skip to duplicate installs. If it prints nothing, add the folder. You only do this once.

Step 3: add the folder

zsh, the default on macOS. The first line saves the setting for every new terminal; the second applies it to the window you are in:

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

bash on Linux:

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

bash on macOS reads ~/.bash_profile instead, because Terminal starts it as a login shell. As we read the docs, if you already have a ~/.bash_login or ~/.profile and no ~/.bash_profile, put the line in that existing file rather than creating a new one.

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

For fish, Nushell and other shells, add ~/.local/bin with your shell's own syntax and restart the terminal.

Windows PowerShell (adds it to your user PATH, then restart the terminal):

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

Windows CMD: open the system settings, go to Environment Variables, add %USERPROFILE%\.local\bin to your User PATH variable, and restart the terminal.

Check it worked:

claude --version

Still not found? Four usual reasons

“Permission denied” when adding the line

If the echo command answers permission denied about your .zshrc or .bashrc, nothing was saved because your user cannot write to that file. Look at who owns it:

ls -l ~/.zshrc

The third column is the owner. If it is another user, such as root, take ownership with sudo chown $(whoami) ~/.zshrc (needs administrator rights). If it is you, the file is read-only: chmod u+w ~/.zshrc. Then run the two PATH commands again.

Duplicate installs

Two copies of Claude Code on one machine can give you the wrong version or odd behaviour. See what your shell finds:

which -a claude

On Windows use where.exe claude. Then look at the places a copy can come from: the native one at ~/.local/bin/claude (a symlink into ~/.local/share/claude/versions/ on a native install), an old local npm install under ~/.claude/local/, and a global npm package (npm -g ls @anthropic-ai/claude-code). “No such file” there is not an error; it just means nothing is installed at that spot.

As we read the docs, the native install is the recommended one, so keep that and remove the extras:

Windows: claude.exe vanished after an update

On Windows, an update renames the current claude.exe to a backup and moves the new one into place. If the move fails and the backup cannot be renamed back, the folder ends up with the backup but no claude.exe. First confirm the folder is on your PATH (step 2); if it is, look inside %USERPROFILE%\.local\bin for a file starting with claude.exe.old. followed by a number. This PowerShell line renames the newest one back:

Get-ChildItem "$env:USERPROFILE\.local\bin\claude.exe.old.*" | Sort-Object Name | Select-Object -Last 1 | Rename-Item -NewName claude.exe

Then run claude --version. If there is no backup file, or it still fails, run the installer again from the official setup page. The docs add that older versions could also delete the backup while claude.exe was missing.

Quick map

All the guides are in the guides index. If your terminal behaves oddly after this, see the terminal setup guide and how to debug your configuration. This follows Anthropic's install troubleshooting documentation as we read it in October 2026. We are not affiliated with Anthropic. We wrote this from the documentation and have not tested every system. File locations, installer behaviour and version details can change, and where this page and the documentation disagree, the documentation wins.

The free loop-stop skill gives long tasks a limit and a stop rule, once the command works. If you want a second pair of eyes on your CLAUDE.md and settings, the Tune-Up Kit is a checklist for exactly that.