Requirements
- Node.js 18 or later
- npm 8 or later (included with Node.js)
- Operating system: macOS, Linux, or Windows (via WSL2)
- macOS
- Linux
- Windows (WSL2)
macOS 12 (Monterey) or later is recommended. The npm installation works on both Intel and Apple Silicon.If you use Homebrew to manage Node.js, install it first:Then install Claude Code:
Authenticate
Run the/login command to sign in with your Anthropic account:
- Claude Pro or Max subscription — sign in via claude.ai
- Anthropic Console (API billing) — sign in via console.anthropic.com
/login once, or when you want to switch accounts.
API key alternative
If you prefer to authenticate with an API key directly instead of OAuth, set theANTHROPIC_API_KEY environment variable:
~/.zshrc, ~/.bashrc, etc.) to make it permanent. When this variable is set, Claude Code uses it instead of the stored OAuth token.
Verify your setup
Run the/doctor command to check that everything is configured correctly:
/doctor shows:
- Your Claude Code version and installation type
- Whether auto-updates are enabled
- Your ripgrep status (used for fast codebase search)
- Any configuration warnings with suggested fixes
/doctor reports an issue, it also tells you how to fix it.
Troubleshooting
'claude' command not found after install
'claude' command not found after install
Your npm global Then add
bin directory may not be in your PATH. Find it with:<prefix>/bin to your PATH. For example:Permission denied when installing globally
Permission denied when installing globally
Avoid using Or use a Node.js version manager like nvm, which avoids the permission issue entirely.
sudo npm install -g. Instead, configure npm to use a directory you own:Login fails or browser does not open
Login fails or browser does not open
If the browser does not open automatically, Claude Code displays the login URL in the terminal. Copy and paste it into your browser manually.If the OAuth flow fails with an SSL error, check whether a corporate proxy or VPN is intercepting HTTPS traffic. You may need to configure your proxy settings or use an API key instead.
Multiple Claude Code installations detected
Multiple Claude Code installations detected
If you have both an npm global install and a native install, Then re-run
/doctor will warn you. Remove the one you are not using:claude /doctor to confirm the warning is resolved.ripgrep not working
ripgrep not working
Claude Code uses ripgrep for fast file search. If Claude Code also ships with a built-in fallback, so most search operations still work even if the system ripgrep is unavailable.
/doctor reports a ripgrep problem, install it with your system package manager:Next steps
Quick Start
Run your first Claude Code session
How it works
Understand the permission model and tool system