Quick Answer
Step-by-step Claude Code installation for Mac, Windows (WSL recommended), and Linux. Authentication via Pro subscription or API key, permission modes, first-run config, and fixes for the most common error: 'zsh: command not found: claude'.
Quick Answer
Install Node.js 18+, then run: npm install -g @anthropic-ai/claude-code. Authenticate with a Claude Pro subscription ($20/mo) or API key. Run claude in any project directory. Total install time: 3-5 minutes. Windows users should use WSL2 for best compatibility.
Prerequisites
- Node.js 18 or newer (recommended: 22 LTS). Check:
node --version - npm (ships with Node.js). Check:
npm --version - A terminal: Mac Terminal/iTerm2, Windows Terminal + WSL2, Linux any shell
- Claude account: Pro $20/mo or Max $100/mo OR Anthropic API key. Get an API key.
Install on Mac
- Open Terminal.
- Install nvm (if you don't have Node.js):
curl -o- https://raw.githubusercontent.com/nvm-sh/nvm/v0.40.0/install.sh | bash source ~/.zshrc nvm install 22 - Install Claude Code globally:
npm install -g @anthropic-ai/claude-code - Verify:
claude --version - Run
claudein any project directory to start.
Install on Windows (WSL2 Recommended)
Option A: WSL2 (recommended)
- Open PowerShell as Admin and run:
wsl --install(installs Ubuntu by default) - Restart Windows when prompted.
- Open Ubuntu from Start Menu, complete first-run setup.
- Inside WSL, follow the Mac install steps above.
Option B: Native Windows (less polished)
- Download Node.js 22 LTS from nodejs.org and install.
- Open PowerShell as Admin:
npm install -g @anthropic-ai/claude-code - Open a new PowerShell window.
- Test:
claude --version
WSL is recommended because Claude Code uses Unix shell semantics (forward slashes, env vars). Native Windows works but expect occasional path issues.
Install on Linux
- Install Node.js 22 via nvm (same as Mac steps).
npm install -g @anthropic-ai/claude-code- Test:
claude --version
Tested on Ubuntu 24.04, Debian 12, Fedora 41, Arch.
Authenticate
First time you run claude, it prompts for authentication:
- Browser OAuth (recommended): Claude opens your browser, you log into Anthropic Console, click Authorize. Token saved to
~/.claude/credentials.json. - API key: set environment variable
ANTHROPIC_API_KEYbefore running. Claude Code uses it directly. - Switch auth: run
claude /logoutthenclaude /login.
Pick a Permission Mode
- default — prompts before file edits and shell commands. Safest for first-time users.
- acceptEdits — auto-applies file edits, prompts only for shell commands. Most professional users live here.
- plan — read-only mode. Claude can analyze code but cannot edit. Useful for code review.
- bypassPermissions — Claude takes any action without prompting. Only use in sandboxed/disposable environments.
Set with claude --permission-mode acceptEdits or change with /permission-mode inside a session.
Your First Claude Code Session
- cd into a project directory:
cd ~/projects/my-app - Run
claude - Type your task: “Add a TypeScript interface for User with id, email, createdAt”
- Claude reads relevant files, proposes changes, asks for approval (default mode).
- Approve with Enter. Claude applies edits.
- Run tests with:
!npm test(the!prefix runs commands in your shell from inside Claude.) - Iterate.
Ctrl+Cto exit.
Common Errors and Fixes
“zsh: command not found: claude”
npm installed Claude Code but the bin directory isn't in PATH. Fix:
# Find npm prefix
npm config get prefix
# /Users/you/.nvm/versions/node/v22.0.0
# Add to ~/.zshrc (or ~/.bashrc)
export PATH="$(npm config get prefix)/bin:$PATH"
# Reload
source ~/.zshrc
# Test
which claude“Authentication failed”
Either your browser blocked the OAuth callback, or your API key is invalid. Try: claude /logout, then claude /login. If still failing, set ANTHROPIC_API_KEY env var directly.
“You've exceeded your rate limit”
You're on Free or Pro and hit the cap. Either wait 5 hours for reset, or upgrade to Max ($100/mo) for 5x more headroom. See Claude pricing guide.
Slow performance
Check your Claude tier (Pro shares limited compute), and switch from Opus to Sonnet for non-complex tasks (Sonnet is much faster).
Master Claude Code for Production AI Development
Installation is step 1. Building production AI products is the actual work. Our AI SaaS Builder course shows you how to use Claude Code + Cursor + n8n to ship AI SaaS products at $10K MRR.
AI SaaS Builder: Production Claude Code Workflows
From install to $10K MRR — Claude Code, Cursor, n8n production patterns and the monetization playbook.
Get AI SaaS Builder →