Claude Code is Anthropic's terminal-based coding agent. Installation is a single npm install on any platform with Node.js 18+, but Windows users should use WSL for full feature support. This guide covers Mac, Windows, and Linux, plus how to update, authenticate, and troubleshoot.
node --version. If you have Node 16 or older, upgrade first.The easiest path is Homebrew:
brew install node
Or via nvm if you manage multiple Node versions:
nvm install 22
nvm use 22
npm install -g @anthropic-ai/claude-code
If you see a permissions error, use sudo npm install -g @anthropic-ai/claude-code or fix npm's global directory with npm config set prefix ~/.npm-global.
claude
First run opens your browser to sign in with your Anthropic account. After login, Claude Code stores a token in ~/.claude and won't prompt again.
cd ~/Projects/my-app
claude
Claude Code starts an interactive session with full access to read, edit, and run commands in the current directory. Exit with Ctrl+D or by typing exit.
Anthropic officially supports Claude Code via WSL (Windows Subsystem for Linux). Native Windows installs work but lack some features (file watchers, certain MCP servers).
Open PowerShell as Administrator:
wsl --install
Restart your machine. Ubuntu opens automatically and asks you to create a Linux user.
curl -fsSL https://deb.nodesource.com/setup_22.x | sudo -E bash -
sudo apt-get install -y nodejs
sudo npm install -g @anthropic-ai/claude-code
The sudo is needed because npm installs globally into /usr/lib on Ubuntu.
claude
WSL automatically opens Windows-side browsers for the OAuth flow. Once authenticated, you can use Claude Code on any folder accessible from WSL — including Windows folders mounted at /mnt/c/Users/YourName/....
npm install -g @anthropic-ai/claude-code in PowerShell. Expect some features to misbehave — most notably, file-watching during long sessions and a handful of MCP integrations.Identical to the Mac flow once Node 18+ is in place. Common Linux installs:
# Ubuntu / Debian
curl -fsSL https://deb.nodesource.com/setup_22.x | sudo -E bash -
sudo apt-get install -y nodejs
sudo npm install -g @anthropic-ai/claude-code
# Fedora / RHEL
sudo dnf install nodejs npm
sudo npm install -g @anthropic-ai/claude-code
# Arch
sudo pacman -S nodejs npm
sudo npm install -g @anthropic-ai/claude-code
# Then authenticate
claude
Re-run the install command with the @latest tag:
npm install -g @anthropic-ai/claude-code@latest
Claude Code also checks for updates on startup and prints a notification when a newer version is available. Check your current version anytime:
claude --version
After install, the claude command is available system-wide. Three common ways to start a session:
claude — Interactive session in the current directoryclaude "fix the bug in src/auth.ts" — One-shot mode with a single instructionclaude --resume — Pick up the last interactive session from this directoryThe npm global bin directory isn't on your PATH. Fix:
npm config get prefix
# Add the output's /bin to your PATH in ~/.zshrc, ~/.bashrc, or equivalent
Either use sudo npm install -g ... or fix npm's global directory:
mkdir ~/.npm-global
npm config set prefix '~/.npm-global'
echo 'export PATH=~/.npm-global/bin:$PATH' >> ~/.zshrc
Claude Code requires Node 18+. Upgrade your Node installation before retrying.
The CLI itself is free to install, but it requires a paid Anthropic plan (Pro $20/mo, Max $100-200/mo) or API credits to run. New API accounts get $5 in trial credits, which is enough to test Claude Code for 1-2 days of moderate use. See the full Claude Code pricing guide for which plan to pick.