Skip to content

Installation & Authentication

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
  1. Install via npm

    Open your terminal and run:

    Terminal window
    npm install -g @anthropic-ai/claude-code
  2. Verify installation

    Check that Claude Code is properly installed:

    Terminal window
    claude --version
  3. Run health check

    Ensure everything is configured correctly:

    Terminal window
    claude doctor

If you encounter permission errors, migrate to a local installation:

Terminal window
# After initial global install attempt
claude migrate-installer

This moves Claude Code to ~/.claude/local/ and sets up a shell alias. No sudo required for future updates.

Using Windows Subsystem for Linux

Both WSL 1 and WSL 2 are supported. Install Node.js within your WSL environment:

Terminal window
# Inside WSL
sudo apt update
sudo apt install nodejs npm
npm install -g @anthropic-ai/claude-code

Claude Code offers three authentication methods to suit different needs:

  1. Start Claude Code

    Terminal window
    cd your-project
    claude
  2. Choose authentication method

    On first run, you’ll see options like:

    Welcome to Claude Code!
    Choose your authentication method:
    1. Anthropic Console (default)
    2. Claude Pro/Max subscription
    3. Enterprise (Bedrock/Vertex)
  3. Complete authentication

    • Console/Claude.ai: Browser opens for OAuth flow
    • Enterprise: Configure environment variables first (see below)
  1. Enable model access in AWS

  2. Configure credentials

    Terminal window
    aws configure
    export CLAUDE_CODE_USE_BEDROCK=1
    export AWS_REGION=us-east-1
  3. Start Claude Code

    Terminal window
    claude
  1. Enable APIs in Google Cloud

    • IAM Credentials API
    • Security Token Service API
    • Vertex AI API
  2. Request model access

  3. Configure authentication

    Terminal window
    # 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
  4. Start Claude Code

    Terminal window
    claude

If you’re behind a corporate proxy:

Terminal window
# HTTP/HTTPS 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.).

Terminal window
# Migrate to local installation
claude migrate-installer
# Restart your shell
source ~/.bashrc # or ~/.zshrc

Node not found error: Ensure you’re using Linux Node.js, not Windows:

Terminal window
which node # Should show /usr/bin/node, not /mnt/c/...

OS detection issues: Force Linux mode:

Terminal window
npm config set os linux
npm install -g @anthropic-ai/claude-code --force --no-os-check

If authentication fails:

Terminal window
# Clear stored credentials
rm -rf ~/.config/claude-code/auth.json
# Try again
claude

Disable auto-updates if needed:

Terminal window
# Via configuration
claude config set autoUpdates false --global
# Or environment variable
export DISABLE_AUTOUPDATER=1

Once installed and authenticated, verify everything works:

  1. Check version and diagnostics

    Terminal window
    claude doctor
  2. Test basic functionality

    Terminal window
    claude "Create a hello world Python script"
  3. Check authentication status

    Terminal window
    claude /whoami
CommandPurpose
claude --versionCheck installed version
claude doctorRun diagnostics
claude updateManually update Claude Code
claude migrate-installerFix permission issues
claude config set <key> <value>Configure settings
claude /logoutSign out and clear credentials

Remember: Claude Code auto-updates by default, keeping you on the latest version with newest features and security fixes.