Claude FastClaude Fast

Claude Code Installation: The Real Guide | Complete Setup Tutorial

Complete Claude Code installation guide with platform-specific solutions, troubleshooting, and community-tested fixes for Windows, macOS, and Linux.

Problem: You want to install Claude Code but don't know where to start. Here's the fastest path from zero to working AI terminal.

How to Install Claude Code: Quick Start

Install Claude Code in under 2 minutes with this command:

npm install -g @anthropic-ai/claude-code
claude --version

Success looks like: A version number displays without errors.

If that worked, skip to Troubleshooting. If not, follow your platform-specific steps below.

Step-by-Step: Install Claude Code on Any Platform

Before you install Claude Code, verify you have:

  1. Node.js 18 or higher installed (check with node --version)
  2. Terminal access (Command Prompt, PowerShell, or Bash)
  3. An Anthropic API key from console.anthropic.com

Install Claude Code on Windows

Critical: Windows requires WSL2. Native Windows installation is not supported.

# Step 1: Install WSL2 with Ubuntu (PowerShell as Administrator)
wsl --install -d Ubuntu
 
# Step 2: Restart your computer when prompted
 
# Step 3: Open Ubuntu terminal and install Node.js
curl -fsSL https://deb.nodesource.com/setup_20.x | sudo -E bash -
sudo apt-get install -y nodejs
 
# Step 4: Install Claude Code
npm install -g @anthropic-ai/claude-code
claude --version

Windows users: Once installed, always use Claude Code from your WSL2 Ubuntu terminal, not PowerShell.

Install Claude Code on macOS

macOS installation works but often needs PATH configuration:

# Standard install
npm install -g @anthropic-ai/claude-code
 
# If you see "command not found", fix PATH:
echo 'export PATH="$(npm config get prefix)/bin:$PATH"' >> ~/.zshrc
source ~/.zshrc
claude --version

Homebrew users: If the above fails, create a direct symlink:

npm list -g @anthropic-ai/claude-code
sudo ln -sf /opt/homebrew/lib/node_modules/@anthropic-ai/claude-code/bin/claude /usr/local/bin/claude

Install Claude Code on Linux

Linux users should configure user-level npm to avoid permission issues:

# Create user npm directory (prevents sudo requirements)
mkdir ~/.npm-global
npm config set prefix '~/.npm-global'
echo 'export PATH=~/.npm-global/bin:$PATH' >> ~/.bashrc
source ~/.bashrc
 
# Install Claude Code
npm install -g @anthropic-ai/claude-code
claude --version

Configure Your API Key

After you install Claude Code successfully, configure authentication:

claude
# Paste your API key when prompted

Get your API key: Visit console.anthropic.com, create an account, navigate to API Keys, and generate a new key starting with sk-.

Verify Your Installation

Test your Claude Code installation:

claude --version    # Shows version number
claude doctor       # Runs diagnostics

Quick functionality test:

mkdir test-project && cd test-project
echo "console.log('Hello!');" > test.js
claude

In the Claude prompt: "Read test.js and explain it"

Success: Claude reads the file and explains the JavaScript code.

Common Errors When You Install Claude Code

Error: "Command Not Found"

Cause: PATH configuration missing after install

Fix:

which claude    # Check if installed
npm list -g @anthropic-ai/claude-code
 
# Add to PATH manually
echo 'export PATH="$PATH:/usr/local/lib/node_modules/@anthropic-ai/claude-code/bin"' >> ~/.bashrc
source ~/.bashrc

Error: "EBADPLATFORM"

Cause: Attempting to install Claude Code on Windows without WSL2

Fix: Install WSL2 first (see Windows section above). There are no workarounds.

Error: "EACCES Permission Denied"

Cause: npm requires sudo (insecure practice)

Fix: Configure user-level npm directory (see Linux section above). This works on all platforms.

Nuclear Reset (Fixes 95% of Issues)

When everything fails, reset completely:

npm uninstall -g @anthropic-ai/claude-code
rm -rf ~/.claude ~/.npm/_cacache
npm cache clean --force
npm install -g @anthropic-ai/claude-code
claude --version

What to Do After You Install Claude Code

Once claude --version works without errors:

  1. Build your first project: First Project Guide
  2. Learn the interface: What is Claude Code
  3. Configure settings: Configuration Basics
  4. Fix common problems: Troubleshooting Guide
  5. See real examples: Examples & Templates

Pro tip: Run claude doctor anytime something feels broken. It auto-detects most configuration issues and suggests fixes.

Last updated on