How to Install Claude Code: Complete Setup Guide

Get Claude Code running on macOS, Linux, or Windows WSL in under 5 minutes. Covers Node.js setup, authentication, IDE integration, and first-run configuration.

Updated Feb 2026 5 min read Beginner

System Requirements

Node.js
v18.0.0 or later
OS
macOS, Linux, Windows (WSL)
Disk Space
~100 MB
Authentication
Anthropic account or API key

Claude Code runs as a Node.js CLI tool. It works on macOS 12+, Ubuntu 20.04+ (and most Linux distros), and Windows 10/11 via WSL 2.

Quick Install (30 Seconds)

If you already have Node.js 18+ installed, Claude Code is a single command:

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

Then start it:

$ claude

That's it. Claude Code will walk you through authentication on first run.

Tip:

Prefer not to install globally? Use npx @anthropic-ai/claude-code to run without installing. This always uses the latest version.

Platform-Specific Setup

macOS Setup

  1. Install Node.js with Homebrew (recommended)

    If you don't have Homebrew: /bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/HEAD/install.sh)"

    $ brew install node
    $ node --version
    v22.x.x
  2. Install Claude Code
    $ npm install -g @anthropic-ai/claude-code
  3. Launch & authenticate
    $ cd your-project
    $ claude
Alternative: nvm

Use nvm install --lts if you need to manage multiple Node.js versions. Install nvm first.

Linux Setup (Ubuntu/Debian)

  1. Install Node.js via nvm
    $ curl -o- https://raw.githubusercontent.com/nvm-sh/nvm/v0.40.1/install.sh | bash
    $ source ~/.bashrc
    $ nvm install --lts
    $ node --version
    v22.x.x
  2. Install Claude Code
    $ npm install -g @anthropic-ai/claude-code
  3. Launch & authenticate
    $ cd your-project
    $ claude
Avoid sudo with npm

If npm install -g asks for sudo, use nvm instead. Installing with sudo can cause permission issues later.

Windows Setup (WSL 2)

Claude Code requires WSL (Windows Subsystem for Linux). Native Windows is not yet supported.

  1. Install WSL 2

    Open PowerShell as Administrator:

    PS> wsl --install

    Restart your computer when prompted. Ubuntu will be installed by default.

  2. Set up Ubuntu & Node.js

    Open the Ubuntu terminal from Start menu:

    $ curl -o- https://raw.githubusercontent.com/nvm-sh/nvm/v0.40.1/install.sh | bash
    $ source ~/.bashrc
    $ nvm install --lts
  3. Install Claude Code
    $ npm install -g @anthropic-ai/claude-code
  4. Launch & authenticate
    $ cd /mnt/c/Users/YourName/projects/your-project
    $ claude
VS Code + WSL

Install the WSL extension in VS Code to seamlessly develop in your WSL environment. Claude Code's VS Code extension works through WSL too.

Authentication & API Keys

Claude Code supports three authentication methods:

Method Best For Setup
Browser login Claude Pro/Team users Run claude and follow the browser prompt
API key Direct API usage Set ANTHROPIC_API_KEY environment variable
Claude for Enterprise Enterprise/SSO Configured by your admin

Option 1: Browser Login (Recommended)

Just run claude and it will open your browser. Log in with your Anthropic account. Your session persists across terminal restarts.

Option 2: API Key

Get an API key from console.anthropic.com and set it as an environment variable:

# Add to your ~/.zshrc, ~/.bashrc, or ~/.profile
export ANTHROPIC_API_KEY="sk-ant-api03-..."
Keep your API key secret

Never commit API keys to git. Add .env to your .gitignore. Use environment variables or a secrets manager.

First Run & Verification

Verify everything works:

$ claude --version
1.0.x (claude-opus-4-6)

$ claude "what files are in this directory?"
I can see the following files in the current directory...

Claude Code features to try on your first run:

IDE Integration

VS Code

Install the official Claude Code extension from the VS Code marketplace:

$ code --install-extension anthropic.claude-code

Or search "Claude Code" in the Extensions panel (Cmd+Shift+X). The extension provides:

JetBrains IDEs

Claude Code works in all JetBrains IDEs (IntelliJ, WebStorm, PyCharm, etc.) through the integrated terminal. A dedicated plugin is also available in the JetBrains Marketplace.

Terminal-Only Usage

Claude Code works great as a standalone CLI. No IDE required:

# Interactive session
$ claude

# One-shot command
$ claude "add error handling to src/api.ts"

# Pipe files for review
$ cat src/auth.ts | claude "find security issues"

Essential Configuration

CLAUDE.md (Project Instructions)

Create a CLAUDE.md file in your project root to give Claude persistent context about your project:

# CLAUDE.md

## Project
This is a Next.js 15 app with TypeScript and Tailwind.

## Conventions
- Use functional components with hooks
- Tests go in __tests__ directories
- Use pnpm, not npm

## Commands
- Build: pnpm build
- Test: pnpm test
- Lint: pnpm lint

See the Claude Code Memory Guide for the complete CLAUDE.md reference.

Permission Modes

Control what Claude Code can do without asking:

# Allow all file edits without asking
$ claude --dangerously-skip-permissions

# Plan mode: Claude proposes changes, you approve
$ claude --plan

Model Selection

# Use a specific model
$ claude --model claude-opus-4-6
$ claude --model claude-sonnet-4-6
$ claude --model claude-haiku-4-5
Model Speed Best For
Opus 4.6 Slower Complex architecture, multi-file refactors
Sonnet 4.6 Fast Everyday coding, default choice
Haiku 4.5 Fastest Quick questions, simple edits

Updating Claude Code

# Update to the latest version
$ npm update -g @anthropic-ai/claude-code

# Check current version
$ claude --version

Claude Code updates frequently with new features and model improvements. We recommend updating weekly or when you notice new features announced.

Auto-update with npx

Using npx @anthropic-ai/claude-code always runs the latest version without manual updates.

Troubleshooting

Common Issues

Issue Solution
command not found: claude Ensure npm global bin is in your PATH. Run npm config get prefix and add /bin to your PATH.
EACCES permission denied Don't use sudo. Fix npm permissions with npm config set prefix ~/.npm-global or use nvm.
Node.js version too old Upgrade with nvm install --lts or brew upgrade node.
Authentication failed Run claude logout then claude to re-authenticate. Check your API key if using one.
Slow responses Check your internet connection. Try a faster model: claude --model claude-sonnet-4-6
WSL: browser won't open Set BROWSER=wslview in your WSL shell, or copy the auth URL manually.

Reset Configuration

# Clear all Claude Code data and start fresh
$ rm -rf ~/.claude
$ claude

Check Installation Health

$ claude --version # Should show version number
$ node --version # Should be v18+
$ npm --version # Should be v9+
$ which claude # Should show install path

Frequently Asked Questions

How much does Claude Code cost?

Claude Code itself is free to install. You need either a Claude Pro subscription ($20/month, includes Claude Code access) or an Anthropic API key (billed per token). API pricing: Sonnet 4.6 is $3/$15 per million input/output tokens. Most coding sessions cost $0.05-$0.50.

Can I use Claude Code offline?

No. Claude Code requires an internet connection to communicate with Anthropic's API. All processing happens in the cloud. Your code is sent to the API for analysis but is not stored or used for training.

Is my code safe?

Anthropic does not use API inputs for model training. Your code is processed in memory and not retained after the session. Enterprise plans offer additional data handling guarantees. See Anthropic's privacy policy for details.

Can I use Claude Code with other AI providers?

Claude Code is designed for Anthropic's Claude models. However, it supports configuring third-party API providers that offer Claude-compatible APIs through the --api-base-url flag or ANTHROPIC_BASE_URL environment variable.

Does Claude Code work with monorepos?

Yes. Claude Code handles monorepos well. Place a CLAUDE.md at the root and optionally in each package directory. Claude will read the relevant instructions based on your working directory.

What languages does Claude Code support?

Claude Code works with every programming language. It's particularly strong with TypeScript, Python, Rust, Go, Java, C++, Ruby, PHP, Swift, and Kotlin. It can also work with config files, documentation, and any text-based format.

Next Steps

Now that Claude Code is installed, explore these resources: