claude: command not found after installing Claude Code

claude: command not found means your shell doesn't search the folder Claude Code was installed to, or the install never finished. For the native installer, add ~/.local/bin (on Windows, %USERPROFILE%\.local\bin) to your PATH and open a new terminal.

Contents

claude: command not found means your shell doesn't search the folder Claude Code was installed to, or the install never finished. For the native installer that folder is ~/.local/bin on macOS and Linux and %USERPROFILE%\.local\bin on Windows, and the installer doesn't add it to your PATH. Add the folder to PATH and open a new terminal.

Paths, commands and messages on this page are from Anthropic's troubleshooting page and setup page as they read on 24 October 2026, and from npm's and Homebrew's docs for those two installs.

Why the shell says claude: command not found#

A shell runs claude from the first PATH folder that has it, and searches nowhere else. Anthropic's native installer puts the launcher at ~/.local/bin/claude, linked into ~/.local/share/claude/versions/. If nothing on your computer has used ~/.local/bin before, it won't be on PATH yet.

The installer notices. Under Setup notes: it prints Native installation exists but ~/.local/bin is not in your PATH. and the command that fixes it, then stops without running that command. The note scrolls past, and the next claude fails.

The wording depends on the shell. Anthropic's page treats all four of these as the same problem:

Where 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

Running claude doctor won't help yet: it's a subcommand of claude, and the shell has to find claude first.

Fix claude: command not found on macOS and Linux#

  1. Is the program there? ls -la ~/.local/bin/claude says. No such file or directory means no native install: run curl -fsSL https://claude.ai/install.sh | bash again and read the last lines it prints. (npm and Homebrew use other folders; see their sections further down.)
  2. Is the folder on PATH? echo $PATH | tr ':' '\n' | grep -Fx "$HOME/.local/bin" prints your path if it is, and then the problem is elsewhere (which claude your shell finds). No output means the folder is missing.
  3. Add the folder to PATH in your shell's config file, then reload that file in the current window:
bash
# zsh, the default on macOS
echo 'export PATH="$HOME/.local/bin:$PATH"' >> ~/.zshrc
source ~/.zshrc

# bash on Linux
echo 'export PATH="$HOME/.local/bin:$PATH"' >> ~/.bashrc
source ~/.bashrc
  1. Run claude --version. A working install prints a version such as 2.1.211 (Claude Code).

On a Mac, bash needs a different file. Terminal starts it as a login shell, which reads ~/.bash_profile and skips ~/.bashrc, so the line goes in ~/.bash_profile (or ~/.bash_login or ~/.profile, if you already have one of those and no ~/.bash_profile). Fish and Nushell need ~/.local/bin added in their own syntax.

Still command not found after that? Three things to look at:

  • Any window opened before the change still has the old PATH. Editor terminals (VS Code and the like) inherit theirs from the editor: quit the editor and reopen it.
  • echo $0 prints the shell you are really in. The line may have gone into the other shell's file.
  • Did the echo … >> ~/.zshrc line print permission denied? Then nothing was saved. Check the owner with ls -l ~/.zshrc: if it's another user such as root, sudo chown $(whoami) ~/.zshrc gives the file back, and if it's you, chmod u+w ~/.zshrc makes it writable.

Fix 'claude' is not recognized on Windows#

Two lines in PowerShell check the file, then your PATH:

powershell
Test-Path "$env:USERPROFILE\.local\bin\claude.exe"
$env:PATH -split ';' | Select-String '\.local\\bin'

False from the first line? There's no native install yet; irm https://claude.ai/install.ps1 | iex in PowerShell fixes that. True, with nothing from the second line, means the folder is missing from your user PATH, and these two lines add it:

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

Open a new terminal before you try claude --version; the old one keeps its PATH. In CMD the installer is curl -fsSL https://claude.ai/install.cmd -o install.cmd && install.cmd && del install.cmd, and you add %USERPROFILE%\.local\bin to the user PATH yourself, under Environment Variables in Windows settings. Neither needs Administrator.

Three Windows cases look like a PATH problem and aren't:

  • claude broke right after an update: claude.exe may be gone, with a claude.exe.old.* backup beside it. Renaming the backup brings it back (how to update Claude Code has the steps).
  • Claude Code was installed inside WSL: claude exists only in the WSL terminal, and PowerShell and CMD will never find it (native Windows or WSL compares the two setups).
  • Typing claude opens the desktop app: an older Claude Desktop registers its own Claude.exe that comes first on PATH. Updating Claude Desktop fixes it.

running scripts is disabled on this system with claude.ps1 in the message is the opposite case: PowerShell found claude, an npm install, and the execution policy blocked it. The fix is in running scripts is disabled for agent CLIs.

Claude Code not found after npm install#

npm keeps global commands in its own folder, <prefix>/bin on macOS and Linux and the prefix folder itself on Windows, and claude is only found if that folder is on PATH:

bash
npm prefix -g                            # for example /usr/local
ls "$(npm prefix -g)/bin/claude"
npm -g ls @anthropic-ai/claude-code

A package that's listed but not found is the PATH problem again, with that bin folder in place of ~/.local/bin. With nvm there's one more trap. nvm keeps a separate set of global packages for each Node version, which is what its --reinstall-packages-from flag is for. Switch with nvm use and the claude you installed under the old version stays behind.

sudo is the wrong fix for EACCES: permission denied from npm install -g. The setup page: "Do NOT use sudo npm install -g as this can lead to permission issues and security risks." Anthropic's answer to npm permission errors is the native installer. After switching, npm uninstall -g @anthropic-ai/claude-code removes the old copy, so only one claude is left.

Homebrew and WinGet installs#

Homebrew has a cask per release channel:

Cask Channel Gets
claude-code stable A version typically about a week behind
claude-code@latest latest Each release as it ships

Both put claude in Homebrew's bin folder (/opt/homebrew/bin on Apple silicon, $(brew --prefix)/bin in general), and that folder has to be on PATH. If brew install --cask claude-code seemed to work and claude is still missing, brew list --cask | grep claude-code tells you whether a cask really installed. Cask 'claude-code' is unavailable comes from an outdated Homebrew index: run brew update, then install again.

On Windows, winget install Anthropic.ClaudeCode installs it. Open a new terminal afterwards and check with where.exe claude.

Still not found? Check which claude your shell finds#

bash
which -a claude      # macOS and Linux: every claude on PATH, first one wins
where.exe claude     # Windows

No output while ~/.local/bin/claude exists points back at PATH. Two lines, two installs. The first one listed runs, which is how an update can land in a copy you never start. Anthropic recommends keeping only the native install and removing the others:

Install Remove it with
npm global install npm uninstall -g @anthropic-ai/claude-code
Local npm install made by older versions rm -rf ~/.claude/local
Homebrew brew uninstall --cask claude-code (or claude-code@latest)
WinGet on Windows winget uninstall Anthropic.ClaudeCode

With only the Claude Code extension for VS Code installed, both commands come up empty too (the FAQ below says why). The first install, sign-in and first task, start to finish, are in Claude Code for beginners.

How Shuriken finds and installs Claude Code#

Shuriken meets this problem on every computer you link, since it runs Claude Code on them, and it doesn't rely on your terminal's PATH. The background service asks your login shell for its PATH, so a claude that works in your Terminal is found even when the app was started without that PATH. On top of that it looks in the folders installers use:

  • ~/.local/bin
  • Homebrew's bin folders
  • npm and Node version-manager folders
  • %USERPROFILE%\.local\bin on Windows

When a computer has no Claude Code at all, Shuriken installs it there by itself, with Anthropic's native installer first and npm into a folder Shuriken owns as the fallback, so nothing needs sudo. Each computer's card in Settings › Devices says where it stands: Missing: Claude Code with an Install button, Installing Claude Code… with a progress bar, or Couldn't install Claude Code with the reason and Try again. A failed install also retries on its own after 5 minutes, doubling the wait up to an hour. A server you add from the app installs and checks the agent CLIs and the GitHub sign-in as part of its setup.

Your own terminal is a separate question, because Anthropic's installer doesn't change PATH whoever runs it. On macOS and Linux the desktop app puts its own shuriken command in ~/.local/bin. When that folder isn't on your PATH and your shell file doesn't mention it yet, the app adds the same export line to ~/.zshrc or ~/.bashrc (~/.bash_profile on a Mac), or fish_add_path $HOME/.local/bin to fish's config.fish, under a # Added by Shuriken comment. New terminals then find a native claude as well. On Windows, or with another shell, use the PATH steps above. To have Claude Code installed and checked on each of your computers, download Shuriken.

Sources

  1. Troubleshoot installation and login (Claude Code docs) (accessed 24 October 2026)
  2. Advanced setup: install Claude Code (Claude Code docs) (accessed 24 October 2026)
  3. npm folders: prefix and executables (npm docs) (accessed 24 October 2026)
  4. npm prefix (npm docs) (accessed 24 October 2026)
  5. nvm: migrating global packages between versions (accessed 24 October 2026)
  6. claude-code cask (Homebrew Formulae) (accessed 24 October 2026)
  7. Homebrew installation: default prefix (accessed 24 October 2026)

Frequently asked questions

How do I run claude doctor before PATH is fixed?

With the full path: ~/.local/bin/claude doctor on macOS and Linux, or %USERPROFILE%\.local\bin\claude.exe doctor in CMD. A full path needs no PATH lookup. doctor then reports install health and lists warnings with suggested fixes, without starting a session.

Do I need sudo to install Claude Code?

No. The native installer writes only to folders in your home directory, and on Windows it doesn't need an administrator. Anthropic's docs tell you never to run sudo npm install -g.

Why doesn't the VS Code extension give me a claude command?

The extension ships a private copy of the CLI for its own chat panel, and that copy never goes on your PATH. For claude in a terminal, install the standalone CLI as well.

Does an update undo the ~/.local/bin PATH fix?

No. The line in your shell's config file (or the User PATH entry on Windows) is read by every new terminal, and updates put claude back in the same folder. You add it once.

Does Shuriken need claude on my PATH?

No. Shuriken reads your login shell's PATH on macOS and Linux and checks the installers' folders, such as ~/.local/bin, on its own. On a computer with no Claude Code at all, it installs it.

Free tools