# -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.

- Canonical: https://guides-ai.pages.dev/guides/fix-claude-command-not-found/
- Plate 01.03 · Topic: Install & set up (https://guides-ai.pages.dev/topics/setup/)
- Published: 10 Jun 2026 · Updated: 06 Sept 2026 · 3 min read
- Source site: guides-ai — https://guides-ai.pages.dev/

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:

```bash
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

```bash
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'`.

```bash
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.

```powershell
$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

```bash
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.

```bash
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

```bash
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](https://code.claude.com/docs/en/troubleshoot-install) has the full
error table.

Still stuck? Reinstall clean on [Windows](/guides/install-claude-code-windows/) or
[macOS and Linux](/guides/install-claude-code-macos-linux/), then open
[your first session](/guides/first-claude-code-session/) — this [agent](/glossary/#agent) needs a
project to point at.
