Short answer: zsh: command not found: claude (or bash: claude: command not found on Linux, 'claude' is not recognized... on Windows) means either Claude Code is not installed yet, or it is installed but its folder is not on your shell’s PATH. Anthropic’s own recommended fix is the native installer, which puts the binary at ~/.local/bin/claude:
curl -fsSL https://claude.ai/install.sh | bashirm https://claude.ai/install.ps1 | iexOpen a new terminal window afterwards — the one you installed from keeps its old PATH — and check:
claude --versionEverything below is checked against Anthropic’s own setup and troubleshooting documentation for Claude Code.
Which message are you seeing?
| Message | Platform | Meaning |
|---|---|---|
zsh: command not found: claude | macOS Terminal (zsh is the default shell) | No install found on this shell's PATH |
bash: claude: command not found | Linux, including a fresh VPS | The same |
'claude' is not recognized as an internal or external command | Windows CMD | The same, CMD's wording |
claude : The term 'claude' is not recognized as the name of a cmdlet | Windows PowerShell | The same, PowerShell's wording |
In every case the fix is the same: install it, or fix the PATH. Work out which.
Install Claude Code
Anthropic’s recommended method is the native installer — it installs a standalone binary (not a Node.js script) and updates itself automatically in the background:
curl -fsSL https://claude.ai/install.sh | bashirm https://claude.ai/install.ps1 | iexcurl -fsSL https://claude.ai/install.cmd -o install.cmd && install.cmd && del install.cmdThree other install methods exist, and each has its own PATH behaviour:
| Method | Command | Auto-updates? |
|---|---|---|
| Native installer (recommended) | curl -fsSL https://claude.ai/install.sh | bash | Yes, in the background |
| Homebrew (macOS) | brew install --cask claude-code | No — run brew upgrade --cask claude-code |
| WinGet (Windows) | winget install Anthropic.ClaudeCode | No — run winget upgrade Anthropic.ClaudeCode |
| npm (global package) | npm install -g @anthropic-ai/claude-code | No — run npm install -g @anthropic-ai/claude-code@latest |
| apt / dnf / apk (Linux) | sudo apt install claude-code | No — through your normal system upgrade |
npm installs require Node.js 22 or later. On an older Node, npm prints an EBADENGINE warning but still finishes the install, and claude still runs, because the npm package only pulls down a native binary through a per-platform optional dependency — it does not run under Node at all once installed.
“Installed but still not found”: fix the PATH
The native installer places the binary at ~/.local/bin/claude on macOS and Linux, or %USERPROFILE%\.local\bin\claude.exe on Windows, and tells you in its own output when that folder is missing from PATH — a line starting Native installation exists but ~/.local/bin is not in your PATH. If you missed that line, or the folder was dropped from PATH afterwards, this is the fix.
First: is it actually there?
ls -la ~/.local/bin/claudeTest-Path "$env:USERPROFILE\.local\bin\claude.exe"No such file or directory (or False) means there is no native install — install it with the command above. A listing (or True) means the binary exists and the problem is PATH; continue below.
Then: is that folder on your PATH?
echo $PATH | tr ':' '\n' | grep -Fx "$HOME/.local/bin"A printed path means it is already there — something else is wrong; see conflicting installs below. No output at all means it is missing, and here is the permanent fix, two commands for your shell:
echo 'export PATH="$HOME/.local/bin:$PATH"' >> ~/.zshrc
source ~/.zshrcecho 'export PATH="$HOME/.local/bin:$PATH"' >> ~/.bashrc
source ~/.bashrcOn macOS specifically, Terminal starts Bash as a login shell, which never reads ~/.bashrc on its own — it reads the first of ~/.bash_profile, ~/.bash_login or ~/.profile that exists. If you use Bash rather than zsh on a Mac, put the line in ~/.bash_profile instead (or whichever of the three already exists), not ~/.bashrc.
| Symptom after adding the PATH line | Cause |
|---|---|
| Still not found in the same window | That terminal was already open and keeps its old PATH — open a new window, or quit and reopen a terminal inside an editor |
| grep -n '.local/bin' ~/.zshrc prints nothing | The echo didn't save — rerun the two commands |
| echo $0 shows a different shell than you edited | The line went into the wrong file — run the matching pair for that shell instead |
On Windows PowerShell, add the directory to your user PATH permanently rather than with $env:PATH alone, which only lasts for the current window:
$currentPath = [Environment]::GetEnvironmentVariable('PATH', 'User')
[Environment]::SetEnvironmentVariable('PATH', "$currentPath;$env:USERPROFILE\.local\bin", 'User')Restart your terminal afterwards, then confirm:
claude --versionSeveral installs fighting each other
claude can come from three places at once on the same machine: the native installer at ~/.local/bin/claude, a legacy local install at ~/.claude/local/ left behind by an older version of Claude Code, and a global npm install. If PATH finds the wrong one first, you get an old version or odd behaviour rather than “not found.” List every claude your shell can see:
which -a claude
npm -g ls @anthropic-ai/claude-code 2>/dev/nullwhere.exe claudeAnthropic’s own recommendation is to keep only the native install and remove the others:
npm uninstall -g @anthropic-ai/claude-coderm -rf ~/.claude/localOn Windows: “Claude Code requires Git for Windows or PowerShell”
Git for Windows is optional, not required — Claude Code falls back to the PowerShell tool when it cannot find Git Bash, so this message means neither was found at all. Installing Git for Windows with “Add to PATH” selected fixes it; if PowerShell itself is missing from PATH, its default location is C:\Windows\System32\WindowsPowerShell\v1.0\.
On Alpine Linux
Alpine and other musl-based distributions do not ship bash or curl by default, so the standard install command fails with a bare not found. Install them first, along with the runtime libraries Claude Code needs there:
apk add bash curl libgcc libstdc++ ripgrepIf ripgrep is missing from Alpine’s main repository for your version, Anthropic’s docs point at the community repository; after adding it and running apk update, set USE_BUILTIN_RIPGREP=0 in settings.json under env.
Confirm it, for good
claude --version
claude doctorclaude --version prints a version string such as 2.1.211 (Claude Code). claude doctor runs a fuller, read-only diagnostic — install health, settings-file errors, update status — without starting a session, and is the fastest way to seewhy something is off once the bare command not found is gone.
Another tool missing after a fresh install, or a PATH problem on a different command entirely? See npx: command not found, nvm: command not found, or the general pattern in command not found: the three causes and the fix for every tool.
Frequently asked
How do I install Claude Code?
Anthropic's recommended native installer: curl -fsSL https://claude.ai/install.sh | bash on macOS, Linux or WSL, or irm https://claude.ai/install.ps1 | iex in Windows PowerShell. It installs a standalone binary at ~/.local/bin/claude (or the Windows equivalent) that updates itself automatically.
Why does claude --version still say command not found after installing?
The install directory, ~/.local/bin, is not on your shell's PATH yet. Add it with echo 'export PATH="$HOME/.local/bin:$PATH"' >> ~/.zshrc (or ~/.bashrc for Bash) and run source on that file, or open a new terminal window — the one you installed from keeps its old PATH.
Should I install Claude Code with npm or the native installer?
The native installer is Anthropic's recommended method: it installs a standalone binary that auto-updates in the background. npm (npm install -g @anthropic-ai/claude-code) also works and needs Node.js 22+, but never run it with sudo — that can leave root-owned files under your npm prefix and break later global installs.
How do I remove a conflicting Claude Code install?
which -a claude (or where.exe claude on Windows) lists every claude binary on your PATH. Keep only the native install and remove the rest: npm uninstall -g @anthropic-ai/claude-code for an npm install, or rm -rf ~/.claude/local for a legacy local install from an older version.