Claude Code Setup
Requirements
| Requirement | Minimum |
|---|---|
| Node.js | v18 or higher |
| npm / npx | bundled with Node |
| Anthropic API key | Required |
| OS | macOS, Linux, or Windows (WSL2) |
Step 1 — Install Claude Code
npm install -g @anthropic-ai/claude-code
Verify the installation:
claude --version
Step 2 — Set your API key
export ANTHROPIC_API_KEY="sk-ant-..."
Make this permanent by adding it to your shell profile (~/.zshrc, ~/.bashrc, etc.):
echo 'export ANTHROPIC_API_KEY="sk-ant-..."' >> ~/.zshrc
source ~/.zshrc
Step 3 — First run
Navigate to any project folder and run:
cd ~/my-project
claude
On first run, Claude Code prompts you to accept the terms and selects a default model. You can change the model at any time.
Step 4 — Global configuration
Claude Code stores global settings at:
~/.claude/settings.json
You can edit this manually or through the /config command inside the REPL.
Troubleshooting
claude: command not found — npm global bin directory isn't in your PATH. Add $(npm bin -g) to your PATH.
API key errors — Make sure the key starts with sk-ant- and has billing enabled on your Anthropic account.
Slow startup — Check your internet connection; Claude Code pings the Anthropic API on start.