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
- macOS (zsh):
zsh: command not found: claude - Linux (bash):
bash: claude: command not found - Windows CMD:
'claude' is not recognized as an internal or external command - PowerShell:
claude : The term 'claude' is not recognized as the name of a cmdlet
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"
- “No such file”,
Falseor “File Not Found”: there is no native install. If you installed another way (npm, Homebrew, WinGet, a Linux package), skip to duplicate installs. If you have not installed at all, run the installer from the official setup page first. - You see the file: the program is there. Go to step 2.
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
- The window is older than the change. An open terminal keeps the PATH it started with. Open a new window. A terminal inside an editor takes its PATH from the editor, so quit and reopen the editor.
- The line was never saved. Run
grep -n '.local/bin' ~/.zshrc(use your own shell's file). If it prints nothing, run the two commands again. - It went into another shell's file. Run
echo $0to see which shell you are in, then use that shell's file. - Windows: the change was not stored. Run
[Environment]::GetEnvironmentVariable('PATH', 'User')and look for.local\binin what it prints. If it is missing, run the two lines again.
“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:
- npm global:
npm uninstall -g @anthropic-ai/claude-code - Homebrew on macOS:
brew uninstall --cask claude-code(useclaude-code@latestif that is the cask you installed) - WinGet on Windows:
winget uninstall Anthropic.ClaudeCode - Old local npm install: remove only the
localfolder inside~/.claude. Look at what is in it first, and do not delete~/.claudeitself, because your settings and history live there.
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
- File missing → install, or find the other install method.
- File there, folder not on PATH → step 3, then a fresh terminal.
- Added it, still nothing → old window, wrong shell file, or not saved.
- Two copies → keep the native one.
- Windows, right after an update → restore the backup.
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.