-bash: claude: command not found — 4 Fixes That Work
claude: command not found means the install directory is not on your PATH. Four fixes: a new terminal, the PATH entry, a duplicate install, npm repair.
On this page5 sections
The installer puts claude at ~/.local/bin/claude on macOS, Linux and WSL, or at
%USERPROFILE%\.local\bin\claude.exe on Windows. The error means your shell cannot see that
directory. Four fixes, commonest first.
1. Open a new terminal
The window that ran the installer kept the environment it started with, so a PATH entry added during the install is invisible to it:
claude --version
What it does: prints a version such as 2.1.211 (Claude Code). If it does, you are done.
2. Put the install directory on your PATH
echo $PATH | tr ':' '\n' | grep -Fx "$HOME/.local/bin"
What it does: prints the directory if it is already on your PATH; no output means it is not — that
is the bug. In PowerShell: $env:PATH -split ';' | Select-String '\.local\\bin'.
echo 'export PATH="$HOME/.local/bin:$PATH"' >> ~/.zshrc
source ~/.zshrc
What it does: appends the directory for Zsh, the macOS default, and reloads it — use ~/.bashrc
on most Linux distributions.
$currentPath = [Environment]::GetEnvironmentVariable('PATH', 'User')
[Environment]::SetEnvironmentVariable('PATH', "$currentPath;$env:USERPROFILE\.local\bin", 'User')
What it does: adds it to your Windows User PATH for good; restart the terminal afterwards.
3. Remove the second installation
which -a claude
What it does: lists every claude on your PATH — where.exe claude in PowerShell.
| Where it came from | Where the binary sits |
|---|---|
| Native installer, macOS/Linux/WSL | ~/.local/bin/claude |
| Native installer, Windows | %USERPROFILE%\.local\bin\claude.exe |
| Older local npm install | ~/.claude/local/ |
| Global npm install | under npm root -g |
| VS Code extension | a private copy inside the extension |
Keep one; the docs recommend the native install. Remove a global npm copy with
npm uninstall -g @anthropic-ai/claude-code, the legacy one with rm -rf ~/.claude/local. The
last row is the trap: the extension never creates ~/.local/bin/claude.
4. Repair an npm install that never placed the binary
Error: claude native binary not installed means npm skipped the per-platform package or its
postinstall step — usually --ignore-scripts, --omit=optional, or
optional=false in an .npmrc. On Windows the placeholder is bin/claude.exe, so the shell
refuses to run it.
node node_modules/@anthropic-ai/claude-code/install.cjs
What it does: runs the postinstall by hand. If the platform package was never downloaded, reinstall without those flags — there is no JavaScript fallback.
Verify it worked
claude doctor
What it does: prints install and settings diagnostics without starting a session — where the
binary lives, settings files that failed to parse, the last update result. /doctor does the same
from inside one; Anthropic’s
install troubleshooting page has the full
error table.
Still stuck? Reinstall clean on Windows or macOS and Linux, then open your first session — this agent needs a project to point at.