Independent tech intelligence, checked against primary sources.

TechPulseMind Useful technology.
No manufactured hype.

How to Fix ‘claude: command not found’ by Adding to PATH

Fix the 'claude: command not found' error. Learn how to add Claude Code to your system PATH on macOS, Linux, and Windows in this step-by-step guide.

How to Fix ‘claude: command not found’ by Adding to PATH

Before you start: versions, package names and storage identifiers change over time. Check the commands against the official documentation for your setup before running them, especially anything that creates, deletes or overwrites data.

The install finished without complaining, you typed claude, and the shell told you it has never heard of it:

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

All four mean the same thing: the binary exists, but the directory holding it is not in your shell’s search path. Nothing is broken and you do not need to reinstall.

Where the binary actually is

The installer places claude at:

  • macOS, Linux, WSL: ~/.local/bin/claude
  • Windows: %USERPROFILE%\.local\bin\claude.exe

That is the path to add. A detail that saves a lot of confusion: the VS Code extension does not put a binary there. It bundles a private copy of the CLI inside the extension directory for its own chat panel, and never adds it to PATH. If the extension is all you have installed, ~/.local/bin/claude will not exist and no amount of PATH editing will conjure it — you need the standalone install first.

Check whether the directory is already on your PATH

On macOS or Linux:

echo $PATH | tr ':' '\n' | grep -Fx "$HOME/.local/bin"

If that prints /Users/you/.local/bin or /home/you/.local/bin, the directory is already there and your problem is something else — skip to the conflicting-installations check below.

On Windows PowerShell:

$env:PATH -split ';' | Select-String '\.local\\bin'

On Windows CMD:

echo %PATH% | findstr /i "local\bin"

No output means the directory is missing from PATH. That is the thing to fix.

Fix it on macOS and Linux

Add the directory to your shell’s config file, then reload it. For zsh, the default on macOS:

echo 'export PATH="$HOME/.local/bin:$PATH"' >> ~/.zshrc
source ~/.zshrc

For bash, the default on most Linux distributions:

echo 'export PATH="$HOME/.local/bin:$PATH"' >> ~/.bashrc
source ~/.bashrc

Closing and reopening the terminal works just as well as source. For fish, Nushell or another shell, use that shell’s own PATH syntax and restart the terminal.

Then confirm:

claude --version

A working install prints a version number such as 2.1.211 (Claude Code).

Fix it on Windows

In PowerShell, append the directory to your User PATH so it survives reboots:

$currentPath = [Environment]::GetEnvironmentVariable('PATH', 'User')
[Environment]::SetEnvironmentVariable('PATH', "$currentPath;$env:USERPROFILE\.local\bin", 'User')

Restart the terminal afterwards — the change does not reach sessions that are already open. If you prefer the GUI, open System Settings → Environment Variables and add %USERPROFILE%\.local\bin to the User PATH.

If instead of a not recognized error you saw the install itself fail — complaining about 'bash', about a parameter named 'fsSL', or about '&&' not being a valid statement separator — that is a different problem: you ran the wrong shell’s install command, and nothing was installed to find. Our Claude Code setup guide has the right command for PowerShell and CMD.

Still not found? Look for conflicting installations

If PATH is correct and claude still misbehaves — or runs an old version — you probably have more than one copy. List every claude on your PATH:

which -a claude

On Windows: where.exe claude.

There are three places a binary can come from, and checking all three takes seconds:

ls -la ~/.local/bin/claude      # native installer
ls -la ~/.claude/local/         # legacy local npm install from older versions
npm -g ls @anthropic-ai/claude-code 2>/dev/null   # npm global install

No such file or directory from any of these is not an error — it just means nothing is installed there. A healthy native install shows ~/.local/bin/claude as a symlink into ~/.local/share/claude/versions/. If it is a script or a symlink you made yourself, that is a custom launcher, and auto-update deliberately leaves it alone.

If you find several, keep one. The native install is the recommended one to keep.

A note on npm installs

Older guides — including an earlier version of this one — treat npm install -g @anthropic-ai/claude-code as the default route and tell you to add ~/.npm-global/bin to PATH. The npm package still exists and still works, but it is no longer the primary install method, and its PATH directory depends on your npm prefix rather than being a fixed location.

Two things worth knowing if you are on the npm route:

  • As of v2.1.198 the npm package requires Node.js 22 or later. On an older Node, npm prints an EBADENGINE warning but the install still completes, because the package downloads a native binary that does not use your Node.js at runtime.
  • Do not use sudo npm install -g. It causes exactly the permission problems it looks like it is solving. If you are hitting npm permission errors, the documented fix is to switch to the native installer: curl -fsSL https://claude.ai/install.sh | bash

The one command worth remembering

claude doctor

It prints read-only installation and settings diagnostics without starting a session — install health, which launcher you have, settings-file validation errors, and the result of the most recent update attempt. When something is off and you cannot tell what, run this before changing anything.

Sources

Related reading

Some links on this page may be affiliate links. If you buy through them we may earn a commission at no extra cost to you. See our affiliate disclosure.