Claude Code Install Fixes: Windows, macOS, and Linux
If npm install -g @anthropic-ai/claude-code fails—or the install completes but your shell cannot find claude—the fix depends on the exact error. For npm-related trouble, switching to the native installer is usually the fastest route.
Start with the native installer
Anthropic now recommends its native installation script. It does not require Node.js.
On macOS, Linux, or WSL:
curl -fsSL https://claude.ai/install.sh | bash
In Windows PowerShell:
irm https://claude.ai/install.ps1 | iex
If you opened Command Prompt, use the CMD-specific installer instead of the PowerShell command:
curl -fsSL https://claude.ai/install.cmd -o install.cmd && install.cmd && del install.cmd
If you see EBADENGINE
Starting with npm package v2.1.198, Claude Code requires Node.js 22 or later. Anthropic notes that an older Node version may still produce only an EBADENGINE warning while the installation itself succeeds, because the installed executable is a native binary and does not depend on Node.js at runtime.
Run claude --version first. If it prints a version, Claude Code is installed. If not, check node -v and upgrade to Node.js 22 or later, or switch to the native installer above.
If you see EACCES: permission denied
Your account cannot write to npm’s global package directory. Do not work around this with sudo npm install -g; Anthropic explicitly advises against it. Use the native installer instead.
If the native install hits the same permission error, restore ownership of ~/.local to your current account and try again:
sudo mkdir -p ~/.local/bin
sudo chown -R $(whoami) ~/.local
If the Windows install command itself fails
Claude Code runs natively on Windows 10 version 1809 or later and Windows Server 2019 or later. Administrator access and WSL are not required.
- If Windows says
'irm' is not recognized as an internal or external command, you ran a PowerShell command in Command Prompt. - If PowerShell says the
&&token is not a valid statement separator, you likely ran the CMD command in PowerShell. - A prompt beginning with
PS C:\is PowerShell. A prompt that begins with onlyC:\is Command Prompt.
If you choose WSL, run the macOS/Linux curl command inside the WSL terminal. Git for Windows is optional on native Windows: Claude Code can use Bash tools when Git for Windows is present and PowerShell tools when it is not.
If Claude Code installed but the command is missing
The native executable is installed at ~/.local/bin/claude on macOS and Linux, and %USERPROFILE%\.local\bin\claude.exe on Windows. A command not found or “not recognized” message usually means that directory is not on PATH.
For the default zsh on macOS:
echo 'export PATH="$HOME/.local/bin:$PATH"' >> ~/.zshrc
source ~/.zshrc
For bash on Linux or WSL, add the same line to ~/.bashrc instead. On Windows, close every terminal window and open a new one. If claude is still missing, add %USERPROFILE%\.local\bin to your user PATH, then open another terminal.
If you get 403 or Failed to fetch version
These errors often appear when a corporate proxy or firewall blocks downloads.claude.ai. A 403 can also mean Claude is unavailable in the country or region your connection is coming from, so check the exit location if you are using a VPN.
On a corporate network, ask IT for the proxy address and set the corresponding environment variables:
export HTTP_PROXY=http://proxy.example.com:8080
export HTTPS_PROXY=http://proxy.example.com:8080
Trying the install over another connection, such as a phone hotspot, is a quick way to separate a network block from a machine-specific problem.
Run claude doctor for a final check of the installation and configuration. If both npm and native copies remain, compare ls ~/.local/bin/claude with npm ls -g @anthropic-ai/claude-code and keep one installation. Anthropic recommends the native build.
If installation works but sign-in does not, check the account as well. Claude Code requires a Pro, Max, Team, Enterprise, or API Console account; it is not available on the free Claude.ai plan. For an error that still will not clear, look up the exact message in Anthropic’s installation troubleshooting guide.