Fix 'command not found: claude' After Install

The Error

After running the Claude Code installer, you get one of these errors when trying to run claude:

zsh: command not found: claude
bash: claude: command not found
'claude' is not recognized as an internal or external command

Quick Fix

The installer places the claude binary at ~/.local/bin/claude. Add that directory to your PATH:

# macOS (zsh)
echo 'export PATH="$HOME/.local/bin:$PATH"' >> ~/.zshrc
source ~/.zshrc

# Linux (bash)
echo 'export PATH="$HOME/.local/bin:$PATH"' >> ~/.bashrc
source ~/.bashrc

On Windows PowerShell:

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

Restart your terminal, then verify:

claude --version

What Is Happening

The Claude Code installer downloads the binary to ~/.local/bin/claude on macOS and Linux. Your shell searches for programs in directories listed in the PATH environment variable. If ~/.local/bin is not in your PATH, the shell cannot find the claude command even though the binary exists on disk.

Step-by-Step Fix

Step 1: Confirm the binary exists

ls -la ~/.local/bin/claude

If the file does not exist, the installation did not complete. Re-run the installer.

Step 2: Check your current PATH

echo $PATH | tr ':' '\n' | grep local/bin

If there is no output, the directory is missing from PATH.

Step 3: Add to PATH permanently

On macOS (default shell is zsh):

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

Step 4: Check for conflicting installations

If you previously installed Claude Code via npm, you may have multiple binaries:

which -a claude
npm -g ls @anthropic-ai/claude-code 2>/dev/null

If you find duplicates, remove the extra installations:

npm uninstall -g @anthropic-ai/claude-code

Step 5: Verify the fix

claude --version

Prevention

After any fresh install, verify immediately with claude --version. For teams, add the PATH requirement to your onboarding documentation. Alternatively, use Homebrew on macOS which handles PATH automatically:

# macOS/Linux
brew install --cask claude-code

# Windows
winget install Anthropic.ClaudeCode

Paste your error into our Error Diagnostic for an instant fix.

Master Claude Code

Get lifetime access to all ClaudHQ tools, advanced workflows, and production-grade templates.

Get Lifetime Access

Written by the ClaudHQ team ยท Expert Claude Code guides and tools