Install Claude Code — All Platforms Guide

Written by Michael Lip · Solo founder of Zovo · $400K+ on Upwork · 100% JSS Join 50+ builders · More at zovo.one

TL;DR: Install with npm install -g @anthropic-ai/claude-code, authenticate with claude /login or set ANTHROPIC_API_KEY, and verify with claude --version.

The Problem

You want to install Claude Code but are unsure which method works for your platform, or your installation attempt failed with errors like:

npm ERR! code EACCES
npm ERR! permission denied

Or Claude Code installed but does not start.

Why This Happens

Claude Code is distributed as an npm package that requires Node.js 18+. Installation issues typically stem from missing Node.js, incorrect npm permissions, or platform-specific PATH configuration.

The Fix

Step 1 — Install Node.js (if needed)

Claude Code requires Node.js 18 or later.

macOS:

# Using Homebrew
brew install node

# Verify version (must be 18+)
node --version

Ubuntu / Debian:

# Using NodeSource
curl -fsSL https://deb.nodesource.com/setup_20.x | sudo -E bash -
sudo apt-get install -y nodejs

node --version

Windows:

# Using winget
winget install OpenJS.NodeJS

# Or download from https://nodejs.org

WSL:

# Same as Ubuntu/Debian
curl -fsSL https://deb.nodesource.com/setup_20.x | sudo -E bash -
sudo apt-get install -y nodejs

Step 2 — Install Claude Code

# Install globally
npm install -g @anthropic-ai/claude-code

# If you get EACCES permission errors:
# Option A: Fix npm permissions
mkdir -p ~/.npm-global
npm config set prefix '~/.npm-global'
echo 'export PATH=~/.npm-global/bin:$PATH' >> ~/.zshrc
source ~/.zshrc
npm install -g @anthropic-ai/claude-code

# Option B: Use npx (no global install)
npx @anthropic-ai/claude-code

Step 3 — Authenticate

# Interactive login (opens browser)
claude /login

# Or set API key directly (works in all environments)
export ANTHROPIC_API_KEY="sk-ant-api03-your-key-here"

Step 4 — Verify Installation

# Check version
claude --version

# Check auth status
claude auth status

# Run a quick test
echo "What is 2+2?" | claude --print

Expected output:

Claude Code v2.1.107
Authenticated as: [email protected]
4

Docker Installation

FROM node:20-slim

RUN npm install -g @anthropic-ai/claude-code

# Set API key at runtime, not in Dockerfile
ENV ANTHROPIC_API_KEY=""

ENTRYPOINT ["claude"]
# Build and run
docker build -t claude-code .
docker run -it -e ANTHROPIC_API_KEY="$ANTHROPIC_API_KEY" claude-code

VS Code Extension

  1. Open VS Code
  2. Go to Extensions (Cmd+Shift+X / Ctrl+Shift+X)
  3. Search “Claude Code”
  4. Install the official Anthropic extension
  5. The extension uses the CLI under the hood — ensure claude is on your PATH

Common Variations

Scenario Cause Quick Fix
npm ERR! EACCES Global npm needs root Use ~/.npm-global prefix or npx
command not found: claude Not on PATH Add npm global bin to PATH
Node version too old <18 installed Update Node.js via nvm or package manager
Works in terminal, not in VS Code VS Code uses different PATH Add npm bin to VS Code terminal profile
WSL: claude starts but no output Shell snapshot issue (v2.1.105) Update to latest version

Prevention


Last verified: 2026-04-14. Found an issue? Open a GitHub issue.