This guide covers everything you need to install Claude Code and authenticate for immediate use. Whether you’re on macOS, Windows, or Linux, we’ll get you coding with AI assistance in under 15 minutes.
Prerequisites
Before installing Claude Code, ensure your system meets these requirements:
Operating System :
macOS 10.15+
Ubuntu 20.04+/Debian 10+
Windows 10+ (with WSL 1/2 or Git for Windows)
Hardware : 4GB+ RAM minimum
Software : Node.js 18+ installed
Network : Internet connection required
Shell : Works best with Bash, Zsh, or Fish
Location : Must be in an Anthropic supported country
Install via npm
Open your terminal and run:
npm install -g @anthropic-ai/claude-code
Verify installation
Check that Claude Code is properly installed:
Run health check
Ensure everything is configured correctly:
If you encounter permission errors, migrate to a local installation:
# After initial global install attempt
This moves Claude Code to ~/.claude/local/
and sets up a shell alias. No sudo
required for future updates.
For a platform-native installation:
# From existing installation
# Or fresh install via curl
curl -fsSL claude.ai/install.sh | bash
Platform support : macOS, Linux, Windows (via WSL)
Using Windows Subsystem for Linux
Both WSL 1 and WSL 2 are supported. Install Node.js within your WSL environment:
sudo apt install nodejs npm
npm install -g @anthropic-ai/claude-code
Using Git Bash
Install Git for Windows
For portable Git installations, set the bash path:
$env:CLAUDE_CODE_GIT_BASH_PATH = " C:\Program Files\Git\bin\bash.exe "
Install Claude Code via npm in Git Bash
Claude Code offers three authentication methods to suit different needs:
Claude Pro/Max Plan Unified subscription for both Claude Code and web interface. Same price, more value
Start Claude Code
Choose authentication method
On first run, you’ll see options like:
Choose your authentication method:
1. Anthropic Console (default)
2. Claude Pro/Max subscription
3. Enterprise (Bedrock/Vertex)
Complete authentication
Console/Claude.ai : Browser opens for OAuth flow
Enterprise : Configure environment variables first (see below)
Enable model access in AWS
Configure credentials
export CLAUDE_CODE_USE_BEDROCK = 1
export AWS_REGION = us-east-1
export AWS_ACCESS_KEY_ID = your-key-id
export AWS_SECRET_ACCESS_KEY = your-secret-key
export AWS_SESSION_TOKEN = your-session-token # If using temporary credentials
export CLAUDE_CODE_USE_BEDROCK = 1
export AWS_REGION = us-east-1
export AWS_BEARER_TOKEN_BEDROCK = your-bedrock-api-key
export CLAUDE_CODE_USE_BEDROCK = 1
export AWS_REGION = us-east-1
Start Claude Code
Enable APIs in Google Cloud
IAM Credentials API
Security Token Service API
Vertex AI API
Request model access
Configure authentication
# Authenticate with Google Cloud
gcloud auth application-default login
# Set environment variables
export CLAUDE_CODE_USE_VERTEX = 1
export CLOUD_ML_REGION = us-east5
export ANTHROPIC_VERTEX_PROJECT_ID = your-project-id
Start Claude Code
If you’re behind a corporate proxy:
export HTTPS_PROXY = ' https://proxy.company.com:8080 '
export HTTP_PROXY = ' http://proxy.company.com:8080 '
# If using self-signed certificates
export NODE_TLS_REJECT_UNAUTHORIZED = 0 # Use with caution
For permanent proxy configuration, add to your shell profile (~/.bashrc
, ~/.zshrc
, etc.).
# Migrate to local installation
source ~/.bashrc # or ~/.zshrc
# Create user-writable npm directory
npm config set prefix ~/.npm-global
echo ' export PATH=~/.npm-global/bin:$PATH ' >> ~/.bashrc
npm install -g @anthropic-ai/claude-code
Node not found error : Ensure you’re using Linux Node.js, not Windows:
which node # Should show /usr/bin/node, not /mnt/c/...
OS detection issues : Force Linux mode:
npm install -g @anthropic-ai/claude-code --force --no-os-check
If authentication fails:
# Clear stored credentials
rm -rf ~/.config/claude-code/auth.json
Disable auto-updates if needed:
claude config set autoUpdates false --global
# Or environment variable
export DISABLE_AUTOUPDATER = 1
Once installed and authenticated, verify everything works:
Check version and diagnostics
Test basic functionality
claude " Create a hello world Python script "
Check authentication status
Pro Tip
For the best experience, many developers run Claude Code with:
claude --dangerously-skip-permissions
This skips constant permission prompts (similar to Cursor’s old “yolo mode”). Use at your discretion based on your security requirements.
Command Purpose claude --version
Check installed version claude doctor
Run diagnostics claude update
Manually update Claude Code claude migrate-installer
Fix permission issues claude config set <key> <value>
Configure settings claude /logout
Sign out and clear credentials
Remember: Claude Code auto-updates by default, keeping you on the latest version with newest features and security fixes.