Claude Code is installed and your shell cannot find it. The native installer writes the binary to ~/.local/bin/claude on macOS and Linux and to %USERPROFILE%\.local\bin\claude.exe on Windows, and that directory is not on your PATH. Open a new terminal first, because the installer edited your shell profile and an already-open shell never re-read it. If that does not work, add the install directory to your profile by hand. The remaining causes are an npm install whose Node prefix moved, a duplicate install, an npm package whose native binary never downloaded, and the VS Code extension, which never puts claude on PATH at all.
- The binary is almost certainly still installed. This is a PATH problem.
- The native installer path is
~/.local/bin/claude, or%USERPROFILE%\.local\bin\claude.exeon Windows. - Cause one: the terminal predates the install. Open a new one.
- The VS Code extension bundles a private copy and never adds
claudeto PATH. - An npm global install disappears when Node changes prefix. Move to the native install.
which -a claudefinds duplicates, which is the other half of this problem.
The thirty-second answer
Your shell searches only the directories in PATH. The installer put claude somewhere that is not in yours, or put it there after your terminal had already read its profile. Nothing is corrupted and nothing needs reinstalling until you have checked both.
The same failure, worded differently by each shell.
| Platform | What you see |
|---|---|
| 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 |
which -a claude
command -v claude
# the four places a claude binary can live
ls -la ~/.local/bin/claude 2>/dev/null # native installer
ls -la ~/.claude/local/ 2>/dev/null # legacy local npm install
npm -g ls @anthropic-ai/claude-code 2>/dev/null # npm global
ls -la /opt/homebrew/bin/claude 2>/dev/null # Homebrew cask
# still nothing? search for it
find ~ -name claude -type f -maxdepth 6 2>/dev/null | head
| Result | Cause | Go to |
|---|---|---|
find located it | Not on PATH | Fix 1, then Fix 2 |
which -a prints two or more | Conflicting installs | Fix 3 |
| It is under an old Node version | Node prefix moved | Fix 4 |
claude exists but errors on launch | npm postinstall never ran | Fix 5 |
| Nothing anywhere | Not installed, or the install failed | Fix 6 |
Where Claude Code actually installs
Knowing the four locations turns this from guesswork into a lookup. Anthropic recommends the native install, and as of August 2026 it is the only one auto-update maintains cleanly.
Install methods and the paths they use, as of August 2026.
| Install method | Binary lands at | Notes |
|---|---|---|
Native installer (install.sh, install.ps1) | ~/.local/bin/claude, or %USERPROFILE%\.local\bin\claude.exe | A symlink into ~/.local/share/claude/versions/. Recommended. |
| Homebrew cask | The Homebrew prefix on your PATH | brew install --cask claude-code |
| WinGet | %USERPROFILE%\.local\bin | winget install Anthropic.ClaudeCode |
| npm global | Under npm root -g | Moves whenever your Node prefix moves |
| Legacy local npm | ~/.claude/local/ | Created by older versions. Safe to remove. |
| VS Code extension | Inside the extension directory | Never added to PATH. See below. |
Fix 1: open a new terminal
The installer appends an export to your shell profile, and a terminal that was already open never re-reads it. This is the single most common cause and the reason so many people hit this immediately after a successful install.
exec $SHELL -l # or just close the window and open a new one
claude --version # prints something like 2.1.211 (Claude Code)
Fix 2: put the install directory on PATH
# is it already there?
echo $PATH | tr ':' '\n' | grep -Fx "$HOME/.local/bin"
# zsh (the macOS default)
echo 'export PATH="$HOME/.local/bin:$PATH"' >> ~/.zshrc
source ~/.zshrc
# bash (most Linux distributions)
echo 'export PATH="$HOME/.local/bin:$PATH"' >> ~/.bashrc
source ~/.bashrc
# fish
fish_add_path ~/.local/bin
claude --version
# is it already there?
$env:PATH -split ';' | Select-String '\.local\\bin'
# add it to the User PATH permanently
$currentPath = [Environment]::GetEnvironmentVariable('PATH', 'User')
[Environment]::SetEnvironmentVariable('PATH', "$currentPath;$env:USERPROFILE\.local\bin", 'User')
claude --version
Fix 3: you have more than one install
Two installs produce the stranger version of this bug: claude resolves, but to the wrong copy, so it reports an old version, ignores your settings, or works in one shell and not another. Keep exactly one.
which -a claude # every claude on your PATH
npm uninstall -g @anthropic-ai/claude-code # npm global
rm -rf ~/.claude/local # legacy local npm install
brew uninstall --cask claude-code # Homebrew, macOS
curl -fsSL https://claude.ai/install.sh | bash
exec $SHELL -l
claude doctor
Fix 4: it vanished after a Node upgrade
This is the characteristic failure of the global npm install. Claude Code worked for weeks, you upgraded Node with nvm, Homebrew, or an installer, and the command disappeared. Nothing is corrupted. The package sits under the previous Node version prefix, which is no longer on your PATH.
# where do global packages live now?
npm root -g
ls "$(npm root -g)" # is @anthropic-ai/claude-code there?
# using nvm? check the other versions
nvm ls
ls ~/.nvm/versions/node/*/lib/node_modules/@anthropic-ai 2>/dev/null
Fix 5: npm installed it but the binary never landed
The npm package is a thin wrapper. It downloads the real binary as a per-platform optional dependency, then a postinstall script copies it into place. If either step is skipped, claude exists as a placeholder script and running it prints this:
Error: claude native binary not installed.
Either postinstall did not run (--ignore-scripts, some pnpm configs)
or the platform-native optional dependency was not downloaded
(--omit=optional).
| Cause | Fix |
|---|---|
--omit=optional, --no-optional, optional=false in .npmrc | Remove it and reinstall. There is no JavaScript fallback. |
--ignore-scripts, or a pnpm config that skips postinstall | Run node node_modules/@anthropic-ai/claude-code/install.cjs |
| Corporate npm mirror | Mirror all eight @anthropic-ai/claude-code-* platform packages, not just the meta package |
| Unsupported platform | Prebuilt binaries cover darwin, linux (glibc and musl), and win32 on x64 and arm64 only |
Fix 6: it genuinely is not installed
curl -fsSL https://claude.ai/install.sh | bash
exec $SHELL -l
claude doctor
irm https://claude.ai/install.ps1 | iex
Neighbouring errors and what they actually are.
| You see | It is |
|---|---|
syntax error near unexpected token '<' | The install URL returned an HTML page. Use Homebrew or WinGet. |
A parameter cannot be found that matches parameter name 'fsSL' | The macOS command run in PowerShell. Use irm ... | iex. |
&& is not valid | The CMD command run in PowerShell. Same fix. |
running scripts is disabled on this system | PowerShell execution policy blocking npm shims. Use the native installer. |
cannot execute binary file: Exec format error | WSL1. Convert to WSL2 with wsl --set-version <Distro> 2. |
claude opens the Claude desktop app on Windows | An old Claude Desktop registered Claude.exe in WindowsApps. Update it. |
codex: command not found | Same class of problem, different CLI. See the Codex guide. |
Questions people ask
Open a new terminal first, since the installer edited your shell profile and an already-open shell never re-read it. If that fails, check whether ~/.local/bin is on your PATH with echo $PATH | tr ':' '\n' | grep -Fx "$HOME/.local/bin", and add export PATH="$HOME/.local/bin:$PATH" to ~/.zshrc if it is missing.
The native installer puts it at ~/.local/bin/claude on macOS and Linux, as a symlink into ~/.local/share/claude/versions/, and at %USERPROFILE%\.local\bin\claude.exe on Windows. An npm global install lives under npm root -g, an older local npm install under ~/.claude/local/, and a Homebrew install in the Homebrew prefix.
A global npm install lives under the Node version prefix that was active when you installed it. Upgrading Node changes that prefix, so the command falls off your PATH. Rather than reinstalling under the new version, remove the npm install and use the native binary, which does not depend on Node.
The extension bundles a private copy of the CLI for its own chat panel and does not add it to your PATH by design, so ~/.local/bin/claude will not exist. Run the standalone install to get claude in a terminal.
Your PATH export sits in an interactive-only file such as .zshrc or .bashrc. Move it to ~/.zprofile or ~/.profile, which login shells read, and the integrated terminal will pick it up.
The npm package downloaded but its platform-specific binary did not, or the postinstall script that copies it into place was skipped. Reinstall without --omit=optional or --ignore-scripts, or run node node_modules/@anthropic-ai/claude-code/install.cjs.
An older Claude Desktop registered a Claude.exe in the WindowsApps directory, which takes PATH priority over the CLI. Updating Claude Desktop to the current version resolves it.
No. It creates root-owned files in your npm tree that break every later install for your user, with errors that point nowhere near the cause. Make ~/.local writable instead: sudo mkdir -p ~/.local/bin && sudo chown -R $(whoami) ~/.local.
Sources
Every figure above was read from these pages on August 2026. Vendors reprice without notice; if you find a stale number, tell us.