Claude Code · Install and setup
command not found: claude
Fix “command not found: claude” on macOS and Linux and “'claude' is not recognized” on Windows: add Claude Code to your PATH, step by step.
Message
The exact error
zsh: command not found: claudeAlso appears as:
- 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
Meaning
Why does my terminal say command not found: claude?
“claude: command not found” means Claude Code is installed but your shell can’t find it, because its folder isn’t on your PATH. The native installer puts it in ~/.local/bin on macOS and Linux and %USERPROFILE%\.local\bin on Windows. Add that folder to PATH, open a new terminal and run claude --version. A terminal opened before the install also keeps the old PATH until you open a new one.
Causes
What causes it?
- You only installed the VS Code extension: it bundles a private copy of Claude Code and doesn’t put
claudeon your PATH - The terminal was opened before installing
- The install folder isn’t on your
PATH - On Windows,
claude.exewent missing after an update
Fix
How do I add Claude Code to my PATH?
Installed only the VS Code extension?
Run the standalone installer to get the
claudecommand in your terminal:curl -fsSL https://claude.ai/install.sh | bashon macOS and Linux, orirm https://claude.ai/install.ps1 | iexin PowerShell.Open a new terminal
The window you installed from keeps its old
PATH. Open a fresh terminal and runclaude --version.Check where it’s installed
The native installer puts
claudein~/.local/binon macOS and Linux and in%USERPROFILE%\.local\binon Windows. If the file exists but its folder isn’t inPATH, add it with the step below for your shell, then open a new terminal.macOS / Linux ls ~/.local/bin/claude echo $PATHWindows PowerShell Test-Path $env:USERPROFILE\.local\bin\claude.exe where.exe claudemacOS and Linux: add ~/.local/bin to PATH
For zsh (the macOS default) add the line to
~/.zshrc; for Bash on Linux,~/.bashrc. For Bash on macOS use~/.bash_profileinstead, because Terminal starts Bash as a login shell that ignores~/.bashrc(if you already have~/.bash_loginor~/.profileand no~/.bash_profile, use that file). fish and Nushell use their own PATH syntax.zsh (macOS default) echo 'export PATH="$HOME/.local/bin:$PATH"' >> ~/.zshrc source ~/.zshrc claude --versionBash on Linux echo 'export PATH="$HOME/.local/bin:$PATH"' >> ~/.bashrc source ~/.bashrc claude --versionWindows: add the folder to your user PATH
In PowerShell, check the PATH first; if nothing prints, add the folder and restart the terminal. A terminal inside an editor, such as VS Code’s, takes its PATH from the editor, so quit and reopen the editor itself. In CMD, check with
echo %PATH% | findstr /i "local\bin", and add%USERPROFILE%\.local\binto your User PATH under Environment Variables in System Settings.Windows PowerShell $env:PATH -split ';' | Select-String '\.local\\bin' $currentPath = [Environment]::GetEnvironmentVariable('PATH', 'User') [Environment]::SetEnvironmentVariable('PATH', "$currentPath;$env:USERPROFILE\.local\bin", 'User')Find conflicting installs
which -a claudeon macOS and Linux, orwhere.exe claudeon Windows, lists everyclaudeon your PATH. A leftover npm global install can shadow the native one: keep one install and remove the others. If'claude' is not recognizedstarted right after an update on Windows, Anthropic documents restoringclaude.exefrom its backup.Follow Anthropic’s PATH steps
The Verify your PATH section covers each platform in detail.
Explained
Why does claude open the Claude Desktop app on Windows?
Older versions of Claude Desktop registered a Claude.exe in the WindowsApps folder, which comes earlier on PATH than the Claude Code CLI, so typing claude launches the desktop app. Anthropic’s fix is to update Claude Desktop to the latest version. If the installer itself printed HTML or script text instead of installing, see install script returns HTML, and for the Git Bash requirement on Windows see Claude Code on Windows requires Git or PowerShell.
FAQ
Questions people ask
How do I add Claude Code to my PATH on Mac?
For zsh, the macOS default, run echo 'export PATH="$HOME/.local/bin:$PATH"' >> ~/.zshrc and then source ~/.zshrc. If you use Bash on macOS, add the same line to ~/.bash_profile instead, because Terminal starts Bash as a login shell that ignores ~/.bashrc. Then run claude --version to check.
How do I fix “'claude' is not recognized” in PowerShell?
Check whether %USERPROFILE%\.local\bin is on your PATH. If it isn’t, add it to your user PATH with [Environment]::SetEnvironmentVariable, then close and reopen the terminal, including the editor if the terminal runs inside VS Code, and run claude --version. If it broke right after an update, restore claude.exe from its backup as Anthropic describes.
Why did claude stop working after an update?
You may have two installs, for example an old npm global install and the native installer, and PATH now points at one that is broken or removed. Run which -a claude on macOS or Linux, or where.exe claude on Windows, to list every copy, keep the native one in .local/bin and remove the others.
I installed the VS Code extension. Why is there no claude command?
The extension bundles its own private copy of Claude Code and doesn’t put claude on your PATH. To use claude in a terminal, run the standalone installer: curl -fsSL https://claude.ai/install.sh | bash on macOS and Linux, or irm https://claude.ai/install.ps1 | iex in PowerShell.
Related
Related errors
- syntax error near unexpected token `<' when installing Claude CodeInstall and setup
- Claude Code on Windows requires either Git for Windows (for bash) or PowerShellInstall and setup
- Raw mode is not supported on the current process.stdinInstall and setup
- Error: Claude Code process exited with code 1Install and setup
Keep exploring