How to Install Claude Code: Complete Setup Guide (2026)

Step-by-step Claude Code installation guide for 2026. Covers native installer, API keys, VS Code integration, model selection, and your first real project.

Bruce

Claude CodeSetupTutorialGetting Started

AI Guides

1917 Words

2026-02-25 04:00 +0000


Claude Code setup guide showing terminal installation and IDE integration

You’ve heard about Claude Code. Maybe you’ve seen the demos. Now you want to try it yourself.

Good news: getting from zero to a working Claude Code setup takes about 10 minutes. This guide covers everything — installation, authentication, configuration, IDE integration, and running your first real task.

By the end, you’ll have Claude Code working in your terminal and IDE, configured for your workflow, and ready to start coding with AI.

Prerequisites

Before we start, make sure you have:

  • Operating system: macOS 13+, Ubuntu 20.04+ / Debian 10+, or Windows 10+ (with Git Bash or WSL 2)
  • RAM: 4 GB minimum
  • Internet connection: Required (Claude Code runs against Anthropic’s API)
  • An Anthropic account: Sign up at claude.ai if you don’t have one
  • A paid plan or API key: Claude Code requires either a Pro/Max subscription ($20+/month) or an API key with credits. See our Claude Code pricing guide for plan details.

Node.js is no longer required. The 2026 native installer handles everything. If you previously installed via npm, you can migrate — we’ll cover that below.

Step 1: Install Claude Code

Open your terminal and run:

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

That’s it. The installer downloads the binary to ~/.local/bin/claude and adds it to your PATH.

Want the latest bleeding-edge features instead of stable?

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

Windows

PowerShell:

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

Command Prompt:

curl -fsSL https://claude.ai/install.cmd -o install.cmd && install.cmd && del install.cmd

WSL 2 (recommended for Windows users who want the full Linux experience):

# Inside your WSL 2 terminal
curl -fsSL https://claude.ai/install.sh | bash

Verify Installation

claude --version

If you see a version number, you’re good. If you get “command not found”, add ~/.local/bin to your PATH:

echo 'export PATH="$HOME/.local/bin:$PATH"' >> ~/.zshrc
source ~/.zshrc

(Replace .zshrc with .bashrc if you use Bash.)

Migrating from npm Install

If you previously installed Claude Code via npm install -g @anthropic-ai/claude-code, migrate to the native installer:

claude install

The npm installation method is deprecated. The native installer is faster, auto-updates, and doesn’t require Node.js.

Run a Health Check

claude doctor

This diagnoses common issues — missing dependencies, PATH problems, authentication status, and more. Run it whenever something feels off.

Step 2: Authenticate

Claude Code needs to know who you are. There are three authentication paths:

Option A: Anthropic Account (Pro/Max Subscribers)

This is the simplest path if you have a Pro ($20/month) or Max ($100–200/month) subscription:

claude

On first launch, Claude Code opens your browser to complete OAuth authentication. Authorize the connection, and you’re in. No API keys to manage.

Option B: API Key (Pay-Per-Token)

If you prefer pay-per-token billing or don’t have a subscription:

  1. Get an API key from console.anthropic.com
  2. Set the environment variable:
export ANTHROPIC_API_KEY="sk-ant-your-key-here"

Add this to your ~/.zshrc or ~/.bashrc for persistence:

echo 'export ANTHROPIC_API_KEY="sk-ant-your-key-here"' >> ~/.zshrc

Option C: Cloud Providers (Enterprise)

For organizations using AWS or GCP:

Amazon Bedrock:

export CLAUDE_CODE_USE_BEDROCK=1
# Configure AWS credentials as usual (aws configure, IAM roles, etc.)

Google Vertex AI:

export CLAUDE_CODE_USE_VERTEX=1
# Configure GCP credentials (gcloud auth, service accounts, etc.)

Both support LLM gateway proxies for enterprise network configurations.

Step 3: Choose Your Model

Claude Code defaults to Sonnet 4.6 — the best balance of speed, capability, and cost for coding tasks. But you have options.

Once inside Claude Code, switch models with the /model command:

CommandModelBest ForRelative Cost
/model sonnetSonnet 4.6Daily coding (default)1x
/model opusOpus 4.6Complex architecture, multi-step reasoning1.67x
/model haikuHaiku 4.5Quick questions, simple tasks0.33x

My recommendation: Stay on Sonnet for 80% of work. Switch to Opus when you’re doing complex multi-file refactors, system design, or debugging particularly tricky issues. Use Haiku for quick lookups and simple questions.

Step 4: Set Up CLAUDE.md

This is the single most impactful thing you can do for Claude Code’s effectiveness. A CLAUDE.md file is a Markdown document in your project root that tells Claude Code everything it needs to know about your project.

Create one now:

touch CLAUDE.md

Here’s a solid starter template:

# Project Context

## Overview
[Brief description of what this project does]

## Tech Stack
- Language: [e.g., TypeScript, Python, Go]
- Framework: [e.g., Next.js 15, FastAPI, Gin]
- Database: [e.g., PostgreSQL, MongoDB]
- Testing: [e.g., Jest, pytest, go test]

## Code Conventions
- [e.g., Use functional components with hooks, no class components]
- [e.g., All functions must have type annotations]
- [e.g., Tests go in __tests__/ directories next to source files]

## Common Commands
```bash
# Run tests
npm test

# Start dev server
npm run dev

# Lint
npm run lint

# Build
npm run build
```

## Architecture Notes
- [e.g., API routes are in src/app/api/]
- [e.g., Shared types are in src/types/]
- [e.g., Database migrations are in prisma/migrations/]

## Important Rules
- [e.g., Never modify files in the vendor/ directory]
- [e.g., Always run tests before committing]
- [e.g., Use environment variables for all secrets — never hardcode]

Claude Code reads this file at the start of every session. A good CLAUDE.md eliminates the need to re-explain your project structure, conventions, and preferences every time — saving tokens and improving response quality.

Step 5: Configure Permissions

By default, Claude Code operates in a cautious mode — it will ask permission before modifying files or running commands. You can customize this with settings.json.

Quick Permission Setup

Create a project-level settings file:

mkdir -p .claude

Then create .claude/settings.json:

{
  "permissions": {
    "allow": [
      "Bash(npm run lint)",
      "Bash(npm run test *)",
      "Bash(npm run build)",
      "Bash(git status)",
      "Bash(git diff *)",
      "Bash(git log *)"
    ],
    "deny": [
      "Bash(rm -rf *)",
      "Read(./.env)",
      "Read(./.env.*)",
      "Read(./secrets/**)"
    ]
  }
}

This pre-approves safe commands (linting, testing, git reads) and blocks dangerous ones (deleting files, reading secrets). Everything else will prompt you for approval.

Commit .claude/settings.json to your repo so the whole team shares the same permission rules.

Permission Modes

Claude Code offers several trust levels:

ModeBehaviorGood For
DefaultAsks before writes/commandsLearning Claude Code, untrusted tasks
SandboxFree within defined boundariesDaily professional use
TrustAuto-approves everythingTrusted automated pipelines
Read-onlyNo tool execution, analysis onlyCode review, planning

Most developers settle on Sandbox mode for daily work — it reduces permission prompts by ~84% while maintaining safety boundaries.

Claude Code works great in a standalone terminal, but IDE integration adds visual editing, diff previews, and checkpoint management.

VS Code / Cursor / Windsurf

Install the Claude Code extension:

  1. Open VS Code (or Cursor/Windsurf)
  2. Go to Extensions (Cmd+Shift+X)
  3. Search for “Claude Code”
  4. Install the official Anthropic extension

Features you get:

  • Inline editing: See Claude’s changes directly in your files before accepting
  • Checkpoints: Snapshot your code state and roll back if needed
  • Multi-session: Run multiple Claude Code sessions in separate tabs
  • File mentions: Use @filename to reference specific files or line ranges

JetBrains (IntelliJ, PyCharm, WebStorm, etc.)

JetBrains IDEs also have native Claude Code integration:

  1. Go to Settings > Plugins
  2. Search for “Claude Code”
  3. Install and restart

The JetBrains integration shows inline diffs and supports the same checkpoint system as VS Code.

Step 7: Your First Real Task

You’re set up. Let’s do something real.

Navigate to a project directory and start Claude Code:

cd ~/my-project
claude

Useful First Commands

Before diving into tasks, try these:

TypeWhat to Try
Explore“What does this project do? Give me a high-level overview.”
Understand“Explain how authentication works in this codebase.”
Fix“There’s a bug in the login flow — users get a 403 after token refresh. Find and fix it.”
Build“Add a /health endpoint that returns the app version and database connection status.”
Test“Write unit tests for the UserService class. Aim for 90% coverage.”
Refactor“The error handling in api/routes.ts is inconsistent. Standardize it.”

Watch the Agentic Loop in Action

When you give Claude Code a complex task, watch what happens:

You > Add a rate limiter to the API endpoints

🔧 [1] list_files({"path": "src/api"})
  ✓ Found 8 route files

🔧 [2] read_file({"path": "src/api/routes.ts"})
  ✓ Read 245 lines

🔧 [3] read_file({"path": "package.json"})
  ✓ Read dependencies

🔧 [4] run_command({"command": "npm install express-rate-limit"})
  ✓ Installed express-rate-limit

🔧 [5] write_file({"path": "src/middleware/rateLimiter.ts"})
  ✓ Created rate limiter middleware

🔧 [6] edit_file({"path": "src/api/routes.ts"})
  ✓ Applied rate limiter to all routes

🔧 [7] run_command({"command": "npm test"})
  ✓ All 47 tests pass

✅ Rate limiting added. Each IP is limited to 100 requests per 15 minutes.
   Modified: src/middleware/rateLimiter.ts (new), src/api/routes.ts

That’s the Agentic Loop — Claude Code autonomously plans, executes, and verifies, chaining multiple tools until the task is complete. One prompt, seven tool calls, zero manual intervention.

Monitor Your Costs

After a few tasks, check how much you’ve spent:

/cost

This shows token usage and estimated cost for your current session. If you’re on the API, this helps you understand your burn rate.

Essential Slash Commands Reference

CommandWhat It Does
/helpShow all available commands
/modelSwitch between Opus / Sonnet / Haiku
/costShow session token usage and estimated cost
/compactCompress conversation history (saves tokens)
/clearReset conversation (start fresh)
/doctorDiagnose configuration issues
/rewindRoll back to a previous checkpoint
/themeChange the visual theme
/terminal-setupConfigure multi-line input shortcuts

Keyboard Shortcuts

ShortcutAction
Shift+EnterMulti-line input (iTerm2, WezTerm, Kitty, Ghostty)
Ctrl+RSearch prompt history
Ctrl+TToggle task list
Esc Esc (double)Rewind to last checkpoint
Shift+TabAuto-accept edits in plan mode
?Show all keyboard shortcuts

Tip for macOS users: If Alt key combinations don’t work, go to your terminal’s preferences and set Option as Meta key.

Troubleshooting

“command not found” after installation

Your PATH doesn’t include ~/.local/bin. Fix it:

export PATH="$HOME/.local/bin:$PATH"
# Make it permanent:
echo 'export PATH="$HOME/.local/bin:$PATH"' >> ~/.zshrc

“exec: node: not found” on WSL

WSL is picking up the Windows Node.js instead of a Linux one. Install Node.js natively in WSL:

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

Certificate errors behind corporate proxy

Your company’s SSL inspection is interfering. Set the CA bundle:

export NODE_EXTRA_CA_CERTS=/path/to/corporate-ca-bundle.crt
export HTTPS_PROXY=http://proxy.company.com:8080

Slow responses or timeouts

  • Check your internet connection
  • Try /model sonnet if you’re on Opus (Sonnet is faster)
  • Run /compact to reduce conversation size
  • Close and restart if the session has been running for hours

Rate limit hit

If you see rate limit warnings:

  • Wait a few minutes (limits reset on a rolling window)
  • Switch to a lighter model: /model haiku
  • Consider upgrading your plan (Pro → Max 5x)
  • If on API, check your rate limits

What to Do Next

You’re up and running. Here’s where to go from here:

  1. Set up CLAUDE.md properly — The single biggest productivity boost
  2. Learn Claude Code Hooks — Automate linting, testing, and formatting on every change
  3. Understand the pricing — Pick the right plan for your usage level
  4. Build your own Claude Code — Understand the Agentic Loop architecture under the hood
  5. Master Claude Code tips — 24 power-user techniques

Claude Code gets better the more context you give it. Invest time in your CLAUDE.md, configure sensible permissions, and start with small tasks before handing it complex refactors. Within a week, you’ll wonder how you coded without it.

Comments

Join the discussion — requires a GitHub account