Getting Claude Code Running on Your Machine
This lesson covers everything you need to install, authenticate, and verify Claude Code across all supported platforms.
System Requirements
| Component | Requirement |
|---|---|
| Operating System | macOS 12+, Ubuntu 20.04+, Windows (WSL2) |
| Node.js | 18.0.0 or higher |
| npm | 8.0.0 or higher |
| Memory | 4GB RAM minimum, 8GB recommended |
| Storage | 500MB free space |
Installation
Claude Code is installed as a global npm package:
# Install Claude Code globally
npm install -g @anthropic-ai/claude-code
# Verify installation
claude --version
Authentication
Claude Code supports two authentication methods:
Option 1: Claude Pro/Team Subscription (Recommended for Learning)
# Launch Claude Code — it will prompt you to authenticate
claude
# Select "Claude.ai login" from the auth menu
# A browser window opens, log in with your Claude account
# Return to terminal — you're authenticated
Option 2: Anthropic API Key (Recommended for Production)
# Set your API key as an environment variable
export ANTHROPIC_API_KEY="sk-ant-..."
# Or add to your shell profile for persistence
echo 'export ANTHROPIC_API_KEY="sk-ant-..."' >> ~/.zshrc
source ~/.zshrc
# Launch Claude Code
claude
Option 3: AWS Bedrock / Google Vertex AI
For enterprise use, Claude Code supports routing through cloud providers:
# AWS Bedrock
export CLAUDE_CODE_USE_BEDROCK=1
export AWS_REGION="us-east-1"
claude
# Google Vertex AI
export CLAUDE_CODE_USE_VERTEX=1
export CLOUD_ML_REGION="us-east1"
claude
First Launch
cd /path/to/your/project
claude
On first launch:
- Claude Code scans your project directory
- Loads any existing CLAUDE.md files
- Shows the interactive terminal UI
- Ready for your first prompt
Platform-Specific Notes
macOS
Works out of the box. If you use Homebrew's Node.js, ensure the global bin is in your PATH:
npm config get prefix # Should be /usr/local or similar
echo $PATH # Verify the bin directory is included
Linux (Ubuntu/Debian)
# If using nvm, ensure the correct Node version is active
nvm use 20
npm install -g @anthropic-ai/claude-code
Windows (WSL2)
Claude Code runs in WSL2 (Windows Subsystem for Linux):
# In WSL2 terminal
sudo apt update && sudo apt install nodejs npm
npm install -g @anthropic-ai/claude-code
Note: Claude Code does not natively support Windows CMD or PowerShell. Use WSL2.
Updating Claude Code
# Update to the latest version
npm update -g @anthropic-ai/claude-code
# Check for updates
claude --version
npm view @anthropic-ai/claude-code version
Troubleshooting Common Installation Issues
"command not found: claude" The npm global bin directory is not in your PATH.
npm config get prefix
# Add <prefix>/bin to your PATH
"EACCES permission denied"
# Fix npm permissions
sudo chown -R $(whoami) $(npm config get prefix)/{lib/node_modules,bin,share}
Authentication timeout Ensure your system clock is synchronized:
# macOS/Linux
date
# If wrong: sudo ntpdate -u pool.ntp.org
You are now ready to use Claude Code. The next lesson covers pricing so you understand how to manage costs as you learn.