Skip to content
AI Dev Toolkit.
Esc
  • Loading…

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

Claude Code
zsh: command not found: claude

Also 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 claude on your PATH
  • The terminal was opened before installing
  • The install folder isn’t on your PATH
  • On Windows, claude.exe went missing after an update

Fix

How do I add Claude Code to my PATH?

  1. Installed only the VS Code extension?

    Run the standalone installer to get the claude command in your terminal: curl -fsSL https://claude.ai/install.sh | bash on macOS and Linux, or irm https://claude.ai/install.ps1 | iex in PowerShell.

  2. Open a new terminal

    The window you installed from keeps its old PATH. Open a fresh terminal and run claude --version.

  3. Check where it’s installed

    The native installer puts claude in ~/.local/bin on macOS and Linux and in %USERPROFILE%\.local\bin on Windows. If the file exists but its folder isn’t in PATH, add it with the step below for your shell, then open a new terminal.

    macOS / Linux
    ls ~/.local/bin/claude
    echo $PATH
    Windows PowerShell
    Test-Path $env:USERPROFILE\.local\bin\claude.exe
    where.exe claude
  4. macOS 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_profile instead, because Terminal starts Bash as a login shell that ignores ~/.bashrc (if you already have ~/.bash_login or ~/.profile and 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 --version
    Bash on Linux
    echo 'export PATH="$HOME/.local/bin:$PATH"' >> ~/.bashrc
    source ~/.bashrc
    claude --version
  5. Windows: 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\bin to 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')
  6. Find conflicting installs

    which -a claude on macOS and Linux, or where.exe claude on Windows, lists every claude on your PATH. A leftover npm global install can shadow the native one: keep one install and remove the others. If 'claude' is not recognized started right after an update on Windows, Anthropic documents restoring claude.exe from its backup.

  7. 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

Search all Claude Code errors

Keep exploring