How to Fix "Command Not Found" and Other Claude Code Setup Errors
Claude Code command not found? The install folder is usually missing from PATH. Add ~/.local/bin, restart your terminal, then run claude --version.
"Command not found" after installing Claude Code almost always means the install worked but your terminal cannot see it. Anthropic's troubleshooting page says the installer puts claude in ~/.local/bin on macOS and Linux, or %USERPROFILE%\.local\bin on Windows. If that folder is not on your PATH, the shell reports an error.
Quick answer: Add
~/.local/bin(Windows:%USERPROFILE%\.local\bin) to your PATH, open a new terminal window, then runclaude --version. Free? The fix is free. Claude Code itself needs a paid plan or a Console account (see below).
The steps below follow Anthropic's official documentation as of 15 October 2026. If you still need to install Claude Code, start with How to Install Claude Code on Mac and Windows.
What do you need before you start?
You need a computer that meets the requirements, a terminal, and the exact error text. Anthropic's setup page lists macOS 13.0+, Windows 10 1809+ or Windows Server 2019+, Ubuntu 20.04+, Debian 10+, or Alpine Linux 3.19+. It also lists 4 GB+ RAM and an x64 or ARM64 processor.
If you have never used a terminal, Anthropic's terminal guide covers it. On macOS, press Cmd + Space, type Terminal and press Enter. On Windows, press Win + X and pick Windows PowerShell (or Terminal).
Copy the error message before you change anything. The table below matches common messages to the right section.
| What you see | Go to |
|---|---|
zsh: command not found: claude (macOS) | Method 1 |
bash: claude: command not found (Linux) | Method 1 |
'claude' is not recognized (Windows) | Method 1, then Method 2 |
'irm' is not recognized or token '&&' is not a valid statement separator | Method 2 |
syntax error near unexpected token '<', 403, curl: (56), TLS errors | Method 3 |
Killed or Illegal instruction | "What other errors come up" |
How do you fix "command not found: claude"? (Method 1: add the folder to your PATH)
Add the install folder to your PATH, then open a new terminal. PATH is the list of folders your shell searches when you type a command. Anthropic notes that the installer detects the problem and prints a note under Setup notes:, but it does not change PATH itself.
On macOS or Linux:
- Open your terminal.
- Check that the file exists. Run
ls -la ~/.local/bin/claude. If you seeNo such file or directory, the native install did not happen, so go to Method 3 and install again. - Check whether the folder is already on your PATH. Run
echo $PATH | tr ':' '\n' | grep -Fx "$HOME/.local/bin". If it prints a path, PATH is fine and you should read the "conflicting installations" tip below. - If it prints nothing, add the folder. Find your shell with
echo $0. For Zsh (the macOS default), run:
echo 'export PATH="$HOME/.local/bin:$PATH"' >> ~/.zshrc
source ~/.zshrc
- For Bash on Linux, use
~/.bashrcinstead:
echo 'export PATH="$HOME/.local/bin:$PATH"' >> ~/.bashrc
source ~/.bashrc
- For Bash on macOS, Anthropic says to use
~/.bash_profile, because Terminal on macOS starts Bash as a login shell that ignores~/.bashrc. If you already have~/.bash_loginor~/.profileand no~/.bash_profile, put the line in that file instead. - Run
claude --version. A working install prints a version number such as2.1.211 (Claude Code).
If you use fish or Nushell, add ~/.local/bin using your shell's own syntax, then restart the terminal.
On Windows PowerShell:
- Check the file exists:
Test-Path "$env:USERPROFILE\.local\bin\claude.exe".Falsemeans no native install, so use Method 3. - Check PATH:
$env:PATH -split ';' | Select-String '\.local\\bin'. - If there is no output, add the folder to your User PATH:
$currentPath = [Environment]::GetEnvironmentVariable('PATH', 'User')
[Environment]::SetEnvironmentVariable('PATH', "$currentPath;$env:USERPROFILE\.local\bin", 'User')
- Close PowerShell, open a new window, and run
claude --version.
On Windows CMD: run dir "%USERPROFILE%\.local\bin\claude.exe" to check the file. Then open System Settings, go to Environment Variables, and add %USERPROFILE%\.local\bin to your User PATH variable. Restart your terminal.
Still not found? Anthropic lists three common causes. A terminal window that was open before the change keeps its old PATH. A terminal inside an editor takes its PATH from the editor, so quit and reopen the editor. Or the line went into another shell's file, so run echo $0 and repeat the steps for that shell.
Two more cases from the same page:
- Only the VS Code extension is installed. The extension bundles a private copy of the CLI and does not add it to PATH. Run the standalone install to use
claudein a terminal. - Conflicting installs. Run
which -a claude(macOS/Linux) orwhere.exe claude(Windows) to list every copy. Anthropic recommends keeping only the native one.
How do you fix Windows errors like "'claude' is not recognized" or "'irm' is not recognized"? (Method 2)
Most of these errors mean you pasted a command into the wrong shell. Anthropic's docs say the irm command is for PowerShell and the curl ... install.cmd command is for CMD. Your prompt shows PS C:\ in PowerShell and C:\ without PS in CMD.
| Error | Cause | Fix |
|---|---|---|
'irm' is not recognized | You are in CMD | Open PowerShell and run irm https://claude.ai/install.ps1 | iex, or use the CMD installer |
The token '&&' is not a valid statement separator | You are in PowerShell but ran the CMD command | Run irm https://claude.ai/install.ps1 | iex |
A parameter cannot be found that matches parameter name 'fsSL' | You ran the macOS/Linux command in PowerShell | Run irm https://claude.ai/install.ps1 | iex |
| Command prints script text and nothing installs | You ran only the download half | Run the complete command, including | iex |
Three other Windows problems come up often:
claudeis missing right after an update. Claude Code renames the oldclaude.exeto a backup before moving the new one in. If that fails, the backup stays. Anthropic's fix renames the newestclaude.exe.old.*file back:
Get-ChildItem "$env:USERPROFILE\.local\bin\claude.exe.old.*" | Sort-Object Name | Select-Object -Last 1 | Rename-Item -NewName claude.exe
- "Claude Code does not support 32-bit Windows". The Start menu has a Windows PowerShell (x86) entry that runs as a 32-bit process, even on a 64-bit PC. Open Windows PowerShell without the x86 suffix and install again.
claudeopens the Desktop app. An older Claude Desktop can register aClaude.exethat takes PATH priority. Anthropic's fix is to update Claude Desktop.
How do you fix install failures like 403, HTML errors, TLS errors or "Killed"? (Method 3)
First test whether your network can reach the download server. Then retry or switch installer. Anthropic says the installer downloads from downloads.claude.ai, and a 200 status on this check means you reached it:
curl -sI https://downloads.claude.ai/claude-code-releases/latest
On Windows PowerShell, call curl.exe explicitly, because plain curl is an alias that rejects -sI.
| Symptom | What it means | Fix (per Anthropic's docs) |
|---|---|---|
syntax error near unexpected token '<' or curl: (22) ... 403 | The URL returned a web page or error, not the script | Retry in a few minutes, check your network, or use Homebrew or WinGet |
curl: (56) Failure writing output to destination | Download was interrupted | Test connectivity, then retry |
TLS connect error, SSL/TLS secure channel | TLS handshake failed | Update CA certificates; in PowerShell 5.1 enable TLS 1.2; check proxy |
Killed / exit code 137 on Linux | Out of memory | Free memory or add swap |
Cask 'claude-code' is unavailable | Stale Homebrew index | Run brew update, then retry |
The alternative installers are one line each:
brew install --cask claude-code
winget install Anthropic.ClaudeCode
Homebrew has two casks. Anthropic says claude-code follows the stable channel and is typically about a week behind, while claude-code@latest gets new versions as soon as they ship. Neither Homebrew nor WinGet updates itself by default, so run brew upgrade claude-code or winget upgrade Anthropic.ClaudeCode now and then.
For the out-of-memory case, Anthropic says the install needs roughly 512MB of free memory, and Claude Code needs at least 4 GB of RAM to run. On a small server, its docs show how to add a 2 GB swap file:
sudo fallocate -l 2G /swapfile
sudo chmod 600 /swapfile
sudo mkswap /swapfile
sudo swapon /swapfile
Then rerun curl -fsSL https://claude.ai/install.sh | bash.
Behind a company proxy, set HTTP_PROXY and HTTPS_PROXY to your proxy address before you install. Ask your IT team for the address and, for TLS inspection errors, the proxy's certificate file.
Which fix should you choose?
Start with Method 1 if the install finished without errors. Use Method 2 if the error names irm, && or fsSL. Use Method 3 if the installer itself failed.
| Method | Cost | Difficulty | Limits | Best for |
|---|---|---|---|---|
| 1. Add folder to PATH | Free | Easy | Needs a native install to exist | "command not found" after a clean install |
| 2. Use the right Windows shell command | Free | Easy | Windows only | irm and && errors |
| 3. Retry, or use Homebrew or WinGet | Free | Medium | Same download hosts; may not fix region or CPU limits | 403, HTML, TLS, curl failures |
| Desktop app | Needs a paid plan | Easy | Different interface from the terminal | People who want to skip the terminal |
Anthropic's docs also point to the Claude Code Desktop app for people who would rather not use a terminal. It is available for macOS and Windows, and on Linux via apt.
What's free and what costs money?
Installing Claude Code and fixing PATH costs nothing. Using it does. As of 15 October 2026, Anthropic's setup page says Claude Code requires a Pro, Max, Team, Enterprise or Console account, and the free claude.ai plan does not include it. It can also run through Amazon Bedrock, Google Cloud's Agent Platform or Microsoft Foundry.
| Item | Cost |
|---|---|
| Native, Homebrew, WinGet installers | Free to download |
| Git for Windows (optional) | Free, optional on Windows |
| Claude Code access | Paid plan or Console account, per Anthropic |
| Free claude.ai plan | Does not include Claude Code |
What other setup errors come up, and how do you fix them?
Beyond PATH, most remaining errors are login problems, old Windows or macOS versions, or a Linux or WSL quirk. These come from Anthropic's install troubleshooting page.
- Login fails or loops. Run
/logout, close Claude Code, then runclaudeagain. If the browser does not open, presscto copy the sign-in URL and paste it into a browser. Over SSH, WSL2 or in a container, the browser may open on another machine, so paste the login code the browser shows into the terminal. - "This organization has been disabled" with an active subscription. An old
ANTHROPIC_API_KEYin your shell is overriding your subscription. Rununset ANTHROPIC_API_KEY(PowerShell:Remove-Item Env:ANTHROPIC_API_KEY), remove anyexport ANTHROPIC_API_KEY=...line from your shell file, and run/statusto see which sign-in method is active. running scripts is disabled on this system(npm on Windows). PowerShell's execution policy blocks npm's.ps1launchers. RunSet-ExecutionPolicy -ExecutionPolicy RemoteSigned -Scope CurrentUser, callclaude.cmd, or use the PowerShell installer instead.EACCES: permission deniedduring install. Anthropic warns againstsudo npm install -gand recommends the native installer. For the native installer, check the folder is writable withtest -w ~/.local/bin && echo "writable" || echo "not writable".dylderrors on macOS. Claude Code requires macOS 13.0 or later. Check Apple menu > About This Mac and update if needed. Homebrew downloads the same binary, so it will not help.cannot execute binary file: Exec format errorin WSL. This is a known WSL1 problem. The cleanest fix iswsl --set-version <DistroName> 2from PowerShell.Illegal instruction. Either the wrong binary was downloaded for your architecture, or the CPU lacks AVX. Anthropic says this affects roughly pre-2013 Intel and AMD processors and some virtual machines, and that there is no native-binary workaround.
Once everything works, claude doctor gives read-only diagnostics. Problems after startup, such as high CPU use or hangs, are covered on a separate Troubleshooting page.
Is this allowed? Region, network and security notes
Yes, these are the vendor's own fixes. Two limits matter. Claude Code is only available in Anthropic's supported countries. If the installer output says "App unavailable in region", no PATH fix will help, and you should not try to get around it.
On a work computer, a firewall or proxy may block downloads.claude.ai. Ask your IT team to allow it rather than bypassing the filter. Never run sudo on the install command or on npm install -g, as Anthropic warns it can create permission and security problems.
What's still unclear?
A few points are still open.
- npm status. The GitHub README says installation via npm is deprecated. Anthropic's setup page still documents it as an advanced option that needs Node.js 22 or later. Prefer the native installer unless you have a reason not to.
- Version-dependent behaviour. Several fixes in Anthropic's docs refer to specific releases (for example, a hang fixed in v2.1.214). If you are on an old version, the symptoms may differ, and updating by rerunning the installer is the documented route.
- Docs change often. Menu names, error text and hosts can shift between releases. The steps above match Anthropic's pages on 15 October 2026. If a step differs on your screen, the vendor page is the authority.
Last checked: 15 October 2026.
Frequently asked questions
Why does Claude Code say command not found after a successful install?
The install finished, but your shell does not search the folder where the installer put claude. Anthropic's docs say the installer places it at ~/.local/bin/claude on macOS and Linux, or %USERPROFILE%\.local\bin\claude.exe on Windows. Add that folder to your PATH, open a new terminal, and run claude --version.
How do I check that Claude Code is installed correctly?
Open a new terminal window and run claude --version. A working install prints a version number, for example 2.1.211 (Claude Code), according to Anthropic's setup docs. For a fuller check, run claude doctor, which prints read-only install and settings diagnostics without starting a session.
Should I use sudo with npm to fix permission errors?
No. Anthropic's docs warn against sudo npm install -g because it can cause permission problems and security risks. Switch to the native installer instead: on macOS, Linux or WSL run curl -fsSL https://claude.ai/install.sh | bash. On Windows PowerShell run irm https://claude.ai/install.ps1 | iex.
Is Claude Code free to use once it is installed?
Not on the free claude.ai plan. Anthropic's setup docs say Claude Code requires a Pro, Max, Team, Enterprise or Console account, and the free claude.ai plan does not include access. You can also use a third-party provider such as Amazon Bedrock, Google Cloud's Agent Platform or Microsoft Foundry.
Why do I get 'irm is not recognized' on Windows?
You are in Command Prompt (CMD), not PowerShell. Anthropic's docs give two options: open PowerShell from the Start menu and run irm https://claude.ai/install.ps1 | iex, or stay in CMD and run the CMD installer command, curl -fsSL https://claude.ai/install.cmd -o install.cmd && install.cmd && del install.cmd.
What do I do if none of the fixes work?
Run claude doctor if claude --version works. If it does not, check the anthropics/claude-code GitHub issues page, or open a new issue with your operating system, the install command you ran and the full error text. Account problems such as login loops go to Anthropic support through the Get help option on claude.ai.
Sources
- Troubleshoot installation and login - Claude Code Docs, Anthropic (2026-10-15)
- Advanced setup - Claude Code Docs, Anthropic (2026-10-15)
- Terminal guide for new users - Claude Code Docs, Anthropic (2026-10-15)
- Troubleshooting - Claude Code Docs, Anthropic (2026-10-15)
- anthropics/claude-code (README), GitHub (Anthropic) (2026-10-15)
- 'claude' is not recognized (CMD, PowerShell) or command not found: claude, Fix the Claude Code PATH, SmartScope (2026-10-15)