How to Install and Set Up Claude Code: Complete Guide (2026)

Step-by-step guide to install Claude Code on macOS, Linux, and Windows. Covers native installer, npm, Homebrew, authentication, MCP setup, and how to add agent capabilities with AnyCap.

by AnyCap

Developer terminal showing Claude Code CLI installation on a dark monitor with green success messages


Claude Code is Anthropic's terminal-based AI coding agent. It reads your codebase, edits real files, runs shell commands, and manages git — all from your command line. No browser tabs, no copy-pasting.

This guide covers every installation method (native, npm, Homebrew), authentication, configuration, and — critically — what to do after installation to transform Claude Code from a coding assistant into a full multimodal agent with image generation, video, web search, and cloud storage.


Prerequisites

Before installing, confirm you have:

  • Operating system: macOS 13+ (Ventura), Ubuntu 20.04+ / Debian 10+, or Windows 10 (1809+) with WSL
  • RAM: 4 GB minimum, 8 GB recommended for larger codebases
  • Internet connection: All AI processing runs on Anthropic's cloud infrastructure — no connection, no Claude Code
  • Anthropic account: Claude Pro ($20/month), Max ($100–200/month), Teams, Enterprise, or Console (API) account. The free Claude.ai plan does not include Claude Code. See our Claude Code pricing comparison for help choosing a plan.
  • Terminal: Bash, Zsh, or PowerShell
  • Node.js 18+: Only required for the npm installation method

No GPU required. Your machine runs a lightweight CLI client; all AI computation happens server-side.


Step 1: Install Node.js (npm Method Only)

If you plan to use the native installer — which is now Anthropic's recommended path — skip this step entirely. The native installer has zero dependencies.

For npm users, check your Node version:

node --version

If the output shows v18.0.0 or higher, move to Step 2. Otherwise, install via nvm (Node Version Manager) to avoid permission headaches:

curl -o- https://raw.githubusercontent.com/nvm-sh/nvm/v0.40.1/install.sh | bash

Close and reopen your terminal, then:

nvm install 22
nvm use 22
node --version  # Should show v22.x.x

Node.js 22 is the current LTS release and works cleanly with Claude Code.


Step 2: Install Claude Code

Three installation methods. Pick one.

Zero dependencies. Auto-updates in the background. This is what Anthropic primarily tests and supports.

macOS and Linux:

curl -fsSL https://claude.ai/install.sh | bash

Windows (PowerShell, run as Administrator):

irm https://claude.ai/install.ps1 | iex

The installer drops the claude binary into your PATH and configures automatic updates. Under a minute, start to finish.

Option B: Homebrew (macOS / Linux)

brew install --cask claude-code

One caveat: Homebrew installations do not auto-update. Run brew upgrade claude-code periodically.

Option C: npm

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

Do not use sudo. If you hit EACCES permission errors, the fix is nvm — not running npm as root. Root-owned npm directories create cascading permission problems.

Verify

Confirm the installation worked:

claude --version

For a full environment diagnostic:

claude doctor

Step 3: Authenticate

claude

On first launch, Claude Code opens your browser for OAuth authentication. Sign in to your Anthropic account, authorize the CLI, and you're connected.

Authentication Options

Browser OAuth (default): Best for personal machines. Works with Pro, Max, Teams, and Enterprise accounts. A session token is stored locally after authorization.

API key (CI/CD and headless): For servers, containers, or pipelines where a browser isn't available:

export ANTHROPIC_API_KEY=sk-ant-your-key-here
claude

Generate your key at console.anthropic.com. API usage is billed per token at Anthropic's standard rates. For a full breakdown of subscription vs API billing, see our Claude Code pricing guide.

Which billing model? Subscriptions (Pro/Max) are simpler for daily use and include Claude Code within your monthly plan. API billing gives granular control for variable or automated workloads.


Step 4: Your First Claude Code Session

Navigate to any project directory:

cd ~/my-project
claude

Claude Code reads your project structure and drops you into an interactive REPL. Start with something low-risk:

> Explain the architecture of this project

It scans your files, identifies the stack, and gives you a structural summary. Then try something with real consequences:

> Add input validation to the user registration form

Claude Code identifies the relevant files, proposes changes, and waits for your confirmation. You review each change in a diff view before accepting — it doesn't blindly overwrite files.

For one-off tasks without entering interactive mode, use the -p (print) flag:

claude -p "Write unit tests for the auth module"

Runs the task, outputs the result, exits. Great for scripting and CI/CD pipelines.


Step 5: Configure Claude Code

Model Selection

Claude Code defaults to the latest available model. Override it:

# Set default model
claude config set model claude-opus-4-7

# Or for a single session
claude --model claude-sonnet-4-6

Permissions

Claude Code asks for confirmation before writing files or running commands. If you trust it on a given project:

claude config set permissions.auto-accept-edits true

Useful for speed. Less useful when working on production code. For a deep dive into all permission modes, subagents, and hooks, see our Claude Code advanced features guide.

Project-Level Settings

Create .claude/settings.json in your project root for team-shared configuration (commit this file):

{
  "permissions": {
    "allow": ["read", "write", "shell"],
    "deny": ["shell:rm -rf *"]
  },
  "model": "claude-sonnet-4-6",
  "environment": {
    "NODE_ENV": "development"
  }
}

For personal overrides that shouldn't be committed, use .claude/settings.local.json.

CLAUDE.md

The single most impactful configuration. Create a CLAUDE.md file in your project root to give Claude persistent context: build commands, code conventions, architecture decisions. Run /init inside Claude Code to auto-generate one, then customize it.

A good CLAUDE.md is concise — aim for 50–100 lines. For every line, ask: "Would removing this cause Claude to make a mistake?" If not, cut it.


Platform-Specific Instructions

macOS

Both Apple Silicon (M1–M4) and Intel Macs are supported. Native installer is the cleanest path:

curl -fsSL https://claude.ai/install.sh | bash

Linux

Works on Ubuntu 20.04+, Debian 10+, and most modern distributions. Same native installer as macOS. On older distros, use npm with nvm.

Windows

Option 1: Native PowerShell installer

irm https://claude.ai/install.ps1 | iex

Option 2: WSL (recommended for full Linux compatibility)

wsl --install
# Reboot, then in WSL terminal:
curl -fsSL https://claude.ai/install.sh | bash

Docker

FROM node:22-alpine
RUN npm install -g @anthropic-ai/claude-code

At runtime, pass the API key as an environment variable — don't bake it into the image.

CI/CD (GitHub Actions example)

- name: AI Code Review
  run: |
    npx @anthropic-ai/claude-code -p "Review this PR for bugs" --output-format json
  env:
    ANTHROPIC_API_KEY: ${{ secrets.ANTHROPIC_API_KEY }}

IDE Integration

Claude Code is terminal-first, but IDE plugins give you native diff viewing.

VS Code: Install "Claude Code" from the Extensions panel, or:

code --install-extension anthropic.claude-code

JetBrains: Settings → Plugins → Marketplace → search "Claude Code" → Install. Changes appear in the IDE's native diff viewer.


Beyond Installation: Give Claude Code Agent Capabilities

This is where most setup guides stop. Claude Code is installed, authenticated, running — but it's limited to what the base CLI provides: file editing, shell commands, git operations.

What Claude Code can't do out of the box:

  • Generate images or edit photos
  • Create or analyze videos
  • Search the live web
  • Store and retrieve files in cloud storage
  • Publish content to the web

These capabilities require MCP servers (Model Context Protocol). MCP is the open standard that lets AI agents connect to external tools. Claude Code supports MCP natively — you configure servers, and Claude can call them directly. For the complete walkthrough, see our guide to adding capabilities to Claude Code with MCP.

The Fast Path: AnyCap Agent CLI

Instead of configuring individual MCP servers one by one, you can give Claude Code a full suite of agent capabilities with a single CLI:

npx -y skills add anycap-ai/anycap -a claude-code

This installs AnyCap's agent capability runtime, giving Claude Code access to:

Capability What It Does Example
Image Generation Create and edit images from text prompts "Generate a hero image for the landing page"
Video Generation Produce videos from text or images "Create a product demo walkthrough"
Web Search Search and crawl the live internet "Research the latest API changes"
Cloud Storage Upload, share, and retrieve files "Store project assets and generate share links"
Web Publishing Deploy content to the web "Publish the changelog as a web page"

One CLI. One authentication flow. Every capability. You don't need to manage separate API keys for image generation, video, search, and storage — AnyCap handles all of that through a single install. For an in-depth look at the MCP integration, including manual server configuration options, see our MCP capabilities guide.

Manual MCP Configuration

If you prefer to configure MCP servers individually, add them to .mcp.json in your project root:

{
  "mcpServers": {
    "github": {
      "command": "npx",
      "args": ["-y", "@modelcontextprotocol/server-github"]
    },
    "postgres": {
      "command": "npx",
      "args": ["-y", "@modelcontextprotocol/server-postgres"]
    }
  }
}

Or add them interactively:

claude mcp add github -- npx -y @modelcontextprotocol/server-github
claude mcp list
claude mcp get github

Troubleshooting

Problem Solution
"command not found: claude" Open a new terminal window. If that doesn't work, re-run the installer or check your PATH.
Node.js too old nvm install 22 && nvm use 22
npm EACCES errors Never sudo. Use nvm instead.
Browser won't open for auth Use API key: export ANTHROPIC_API_KEY=sk-ant-...
Network errors during install Check proxy settings. Set npm registry: npm config set registry https://registry.npmjs.org/
Claude Code runs slowly Network latency to Anthropic's API. Check status.anthropic.com. Disconnect VPN if active.

Run claude doctor before spending time on manual debugging — it auto-detects most configuration issues.


Keeping Claude Code Updated

Native installer: Updates happen automatically. No action needed. Check your version with claude --version.

npm: npm update -g @anthropic-ai/claude-code

Homebrew: brew upgrade claude-code


Next Steps

Claude Code is installed. Here's where to go:

  1. Generate a CLAUDE.md — Run /init inside Claude Code to give it persistent project context.
  2. Add agent capabilities — Install AnyCap to give Claude Code image generation, video, search, and storage. See our MCP capabilities guide.
  3. Try a real task — Pick something you'd normally spend 20 minutes on and see how Claude handles it.

Claude Code is the fastest way to bring AI into your development workflow without changing tools. Once it's set up, the difference is immediate.