On this page
Installation on macOS and Windows
What you'll learn
- Install Claude Code on macOS using npm
- Install Claude Code on Windows (via WSL)
- Authenticate and run your first command
- Troubleshoot common install issues
Installing Claude Code takes a few minutes. Let's walk through it.
macOS
Claude Code is distributed as an npm package. If you have Node.js 18+ installed, you can install it globally:
npm install -g @anthropic-ai/claude-code
Verify the install:
claude --version
If you see a version number, you're good.
Authenticate
The first time you run claude, you'll be prompted to log in. Two options:
- Claude Pro / Max subscription: log in with your Anthropic account (recommended — no API cost per message)
- API key: set
ANTHROPIC_API_KEYin your shell profile
export ANTHROPIC_API_KEY="sk-ant-..."
Then:
cd ~/Projects/my-project
claude
Windows
Claude Code runs on Windows, but the best experience is via WSL (Windows Subsystem for Linux). Install WSL first if you haven't:
wsl --install
Restart, open your WSL terminal (Ubuntu by default), then install Node and Claude Code inside WSL:
# Install Node (if not already)
curl -fsSL https://deb.nodesource.com/setup_20.x | sudo -E bash -
sudo apt install -y nodejs
# Install Claude Code
npm install -g @anthropic-ai/claude-code
Your projects should live inside the WSL filesystem (~/ inside WSL, not /mnt/c/) for best performance.
First-run configuration
The first time you run claude in a project, it creates a .claude/ folder and writes your preferences. You don't need to touch these files manually — Claude Code manages them.
Troubleshooting
command not found: claude — The global npm bin directory isn't in your PATH. Run npm config get prefix and add <prefix>/bin to your PATH.
Corporate network / proxy — Set HTTPS_PROXY in your shell environment before launching Claude Code.
Permission errors on install — On macOS or Linux, avoid sudo npm install -g. Instead, configure npm to use a local prefix: npm config set prefix ~/.npm-global, then add ~/.npm-global/bin to your PATH.
Next
You have Claude Code installed and authenticated. Next lesson: starting your first project.
Reflect
What's the environment you spend most of your coding time in? Make sure Claude Code runs there smoothly before moving on.