Claude Code

Installation and login troubleshooting

Installation, PATH, conflicting installations, permissions, TLS/proxies, Windows/WSL, Docker, login, and OAuth.

This page covers problems before the CLI runs normally. If it starts but settings, hooks, MCP, or memory fail, see Configuration debugging. For runtime API failures, see Error reference.

#Run diagnostics first

claude doctor
claude --version
which -a claude

Windows PowerShell:

claude doctor
claude --version
where.exe claude

Native installations usually live at ~/.local/bin/claude or %USERPROFILE%\.local\bin\claude.exe. The CLI bundled with the VS Code extension is not the same as a terminal claude command.

#Quick reference

SymptomFirst action
command not found: claudeAdd the installation directory to PATH
Windows not recognizedOpen a new terminal; inspect the user .local/bin directory
Installer returns HTMLProxy, login page, or firewall replaced the download
curl: (56)Network interruption or unwritable output directory
TLS/SSL failureCheck corporate CA, proxy, and certificate chain
Homebrew cask missingUpdate Homebrew or use the native installer
Linux installer KilledInsufficient memory; add swap or use another machine
Docker installation hangsUse noninteractive installation, a pinned version, and dependencies
Windows shell syntax errorDo not mix PowerShell, CMD, and Bash syntax
WSL npm installation failsUse Linux Node/npm inside WSL, not Windows paths
OAuth invalid codeRetry with the browser and CLI in the intended environment
403 after loginAccount, organization, region, or enterprise policy

#Network and downloads

Check access to the official download domain:

/usr/bin/curl -sI https://downloads.claude.ai/claude-code-releases/latest

In PowerShell, use curl.exe rather than the curl alias:

curl.exe -sI https://downloads.claude.ai/claude-code-releases/latest

For a corporate proxy:

export HTTP_PROXY="http://proxy.example.com:8080"
export HTTPS_PROXY="http://proxy.example.com:8080"

For TLS errors, first trust the corporate root certificate in the system. If Node needs an extra CA:

export NODE_EXTRA_CA_CERTS="/path/to/corporate-ca.pem"

#PATH

macOS/Linux:

echo $PATH | tr ':' '\n' | grep -Fx "$HOME/.local/bin"
echo 'export PATH="$HOME/.local/bin:$PATH"' >> ~/.zshrc
source ~/.zshrc
claude --version

Bash users should replace .zshrc with .bashrc.

Windows PowerShell:

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

Open a new terminal after changing PATH.

#Conflicting installations

Multiple claude binaries can produce inconsistent versions or invoke an older installation.

macOS/Linux:

which -a claude
ls -la ~/.local/bin/claude
ls -la ~/.claude/local/
npm -g ls @anthropic-ai/claude-code 2>/dev/null

Remove an obsolete npm global installation only after confirming it is the unwanted one:

npm uninstall -g @anthropic-ai/claude-code
rm -rf ~/.claude/local

If you previously used Homebrew and intend to remove that installation:

brew uninstall --cask claude-code

Windows PowerShell:

where.exe claude
Test-Path "$env:USERPROFILE\.local\bin\claude.exe"
Remove-Item -Recurse -Force "$env:USERPROFILE\.claude\local"

The removal commands affect the old local installation directory, not all Claude configuration. Inspect paths before running them.

#Permissions and directories

SymptomAction
Cannot write ~/.local/binCheck ownership
Global npm permission errorPrefer native installation over sudo npm install -g
curl output write failureCheck disk, directory permissions, and temporary directory
macOS quarantine or dyld failureReinstall the official binary for the correct architecture
Linux musl/glibc mismatchUse the binary for the distribution
Illegal instructionCPU/architecture incompatible with the binary
WSL1 Exec format errorUpgrade to WSL2 or use a compatible installation

#Windows and WSL

EnvironmentRecommendation
PowerShellUse the PowerShell installer, not the Bash installer
CMDReopen after PATH changes
Git BashConfirm Bash exists; avoid mixing Windows and WSL paths
WSL2Install Linux Node and Claude Code inside WSL
32-bit WindowsUnsupported; use a normal 64-bit environment
DockerPreinstall dependencies and CAs; avoid interactive login requirements

Claude Code needs a supported shell. If your version requests Git for Windows or PowerShell, install the required shell and retry.

#Login and OAuth

For official-account authentication problems:

claude /login
claude doctor

If login state is confused, inspect claude doctor before resetting it. Platform-specific state differs; do not blindly delete all of ~/.claude.

SymptomPossible cause
OAuth invalid codeRedirect intercepted, stale code, browser/CLI mismatch
403 after loginRegion, disabled organization, plan, or enterprise policy
WSL/SSH/container login failureBrowser callback cannot reach the remote shell; use the appropriate API-key flow or local login
Token expiredRepeat /login for the official account
Missing cloud credentialsCheck provider environment, profile, and permissions

#Passion8 authentication

Passion8 normally requires no official OAuth login. Configure the gateway credentials:

ANTHROPIC_BASE_URL="https://passion8.cc" \
ANTHROPIC_AUTH_TOKEN="sk-YOUR_PASSION8_API_KEY" \
claude -p "Reply only with ok"

If this works but interactive mode fails, shell/user/project settings may not pass the variables to that process. Continue with Configuration debugging.

#Official references

Support

Need help?

For setup, billing, or model issues, email us. Check the status page for uptime.

WeChat / QQ support is available at the bottom right.