How to Install Claude Code CLI in 2026: Complete Setup Guide

Install Claude Code in 2 minutes. macOS, Linux, Windows setup. Configure API keys, fix common errors, and power Claude Code with free Anthropic credits.

Claude CodeInstall Claude CodeClaude CLIClaude Code SetupAI Perks
Author Avatar
Andrew
AI Perks Team
13,275

Quick Answer

Install Claude Code with `npm install -g @anthropic-ai/claude-code@latest`. Requires Node.js 18+. Verify with `claude --version`. Authenticate via `claude auth login` or set ANTHROPIC_API_KEY. Power it for free with Anthropic credits worth $1,000-$25,000+ at getaiperks.com.

AI Perks

AI Perks curates and provides access to exclusive discounts, credits, and deals on AI tools, cloud services, and APIs to help startups and developers save money.

AI Perks Cards

How to Install Claude Code CLI in 2026

To install Claude Code, run npm install -g @anthropic-ai/claude-code@latest in your terminal. The install takes about 30 seconds. Verify with claude --version, then authenticate with claude auth login to start using it.

Claude Code requires Node.js 18 or later. Once installed, it runs on macOS, Linux, and Windows with the same commands. And while you're setting it up, AI Perks can get you free Anthropic credits worth $1,000-$25,000+ to power Claude Code at zero cost.


Save your budget on AI Credits

Search deals for
OpenAI
OpenAI,
Anthropic
Anthropic,
Lovable
Lovable,
Notion
Notion

Promote your SaaS

Reach 90,000+ founders globally looking for tools like yours

Apply now

System Requirements

RequirementMinimumRecommended
Node.js18.020+ (LTS)
npm9.010+
OSmacOS 12+, Ubuntu 20.04+, Windows 10+Latest
RAM4 GB8 GB+
Disk Space500 MB2 GB+
InternetRequiredStable broadband

Check your Node.js version:

node --version

If it's below 18, install the latest LTS from nodejs.org or use nvm.


AI Perks

AI Perks curates and provides access to exclusive discounts, credits, and deals on AI tools, cloud services, and APIs to help startups and developers save money.

AI Perks Cards

Install Claude Code on macOS

Step 1: Install Node.js (If Not Already)

Use Homebrew:

brew install node

Or download from nodejs.org.

Step 2: Install Claude Code

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

Step 3: Verify Installation

claude --version

You should see a version number printed (e.g., 1.x.x).

Step 4: Authenticate

claude auth login

This opens a browser to log in via your Anthropic account.


Install Claude Code on Linux

Step 1: Install Node.js (Ubuntu/Debian)

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

For other distros (Fedora, Arch, etc.), use your package manager.

Step 2: Install Claude Code

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

If you get permission errors, don't use sudo with npm. Instead, fix npm's prefix:

mkdir ~/.npm-global
npm config set prefix '~/.npm-global'
echo 'export PATH=~/.npm-global/bin:$PATH' >> ~/.bashrc
source ~/.bashrc

Then reinstall.

Step 3: Verify and Authenticate

claude --version
claude auth login

Install Claude Code on Windows

Step 1: Install Node.js

Download the Windows installer from nodejs.org and run it. Make sure "Add to PATH" is checked during installation.

Step 2: Open PowerShell or Terminal

Open PowerShell (or Windows Terminal) as Administrator.

Step 3: Install Claude Code

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

Step 4: Verify Installation

claude --version

If claude is not recognized, restart your terminal or check that npm's global bin folder is in your PATH:

npm config get prefix

Add the resulting path (with \ appended) to your system PATH variable.

Step 5: Authenticate

claude auth login

Authentication Methods

Claude Code supports three authentication methods:

Method 1: OAuth Login (Easiest)

claude auth login

Opens a browser to log in via your Anthropic account. Best for personal use with a Pro/Max subscription.

Method 2: API Key (Recommended for Free Credits)

Set your Anthropic API key as an environment variable:

macOS/Linux:

export ANTHROPIC_API_KEY="sk-ant-..."
echo 'export ANTHROPIC_API_KEY="sk-ant-..."' >> ~/.zshrc  # or ~/.bashrc

Windows (PowerShell):

[System.Environment]::SetEnvironmentVariable('ANTHROPIC_API_KEY', 'sk-ant-...', 'User')

This is the best option for using free Anthropic credits from AI Perks instead of a paid subscription.

Method 3: Config File

Edit ~/.claude/auth/credentials.json:

{
  "api_key": "sk-ant-...",
  "auth_type": "api_key"
}

First-Time Setup: Verify Everything Works

After installation and authentication:

Test Basic Functionality

claude

You should see the Claude Code REPL. Try a prompt:

Hello! What model are you running?

Claude should respond with a greeting and indicate the active model.

Test File Operations

Navigate to a project folder:

cd ~/projects/my-app
claude

Ask Claude to read your README:

Can you read the README.md and summarize this project?

If Claude reads and responds, your setup works.


Common Installation Errors and Fixes

Error: npm ERR! EACCES permission denied

You don't have permission to write to npm's global folder. Fix:

# Don't use sudo. Instead, change npm's prefix:
mkdir ~/.npm-global
npm config set prefix '~/.npm-global'
export PATH=~/.npm-global/bin:$PATH

Add the export to your ~/.zshrc or ~/.bashrc to make it permanent.

Error: command not found: claude

After installation, the claude command isn't found. Causes:

  1. Terminal not restarted - Close and reopen your terminal
  2. PATH missing npm bin - Run echo $(npm config get prefix)/bin and add to PATH
  3. Wrong shell config - For zsh, edit ~/.zshrc; for bash, edit ~/.bashrc

Error: Node.js version too old

Claude Code requires Node.js 18+. Upgrade:

# macOS (Homebrew)
brew upgrade node

# Linux (nvm)
nvm install 20
nvm use 20

# Windows
# Download latest LTS from nodejs.org

Error: Authentication failed

  • Verify your API key starts with sk-ant-
  • Check it hasn't been revoked at console.anthropic.com
  • Ensure no extra spaces in your ANTHROPIC_API_KEY environment variable
  • Try regenerating the key

Error: Cannot find module '@anthropic-ai/claude-code'

The install didn't complete. Try:

npm cache clean --force
npm install -g @anthropic-ai/claude-code@latest --force

Power Claude Code With Free Anthropic Credits

Claude Code requires either a paid subscription ($20-$200/month) or API credits to actually run. Free Anthropic credits via AI Perks cover the API cost entirely.

Credit ProgramAvailable CreditsHow to Get
Anthropic Claude (Direct)$1,000 - $25,000AI Perks Guide
AWS Activate (Bedrock - Claude)$1,000 - $100,000AI Perks Guide
Google Cloud Vertex (Claude)$1,000 - $25,000AI Perks Guide
Microsoft Founders Hub$500 - $1,000AI Perks Guide
VC + Accelerator Programs$1,000 - $5,000AI Perks Guide

Total potential: $4,500 - $156,000+ in free Claude credits

After installing Claude Code, configure it with an API key powered by free credits and skip subscription billing entirely.


Step-by-Step: Install + Run Claude Code for Free

Step 1: Install Claude Code

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

Step 2: Get Free Anthropic Credits

Subscribe to AI Perks and apply for credit programs. Most decisions land within a week.

Step 3: Generate an API Key

Log into console.anthropic.com and create an API key in Settings > API Keys.

Step 4: Configure Claude Code

export ANTHROPIC_API_KEY="sk-ant-..."

Add to your shell config to make it persistent.

Step 5: Start Coding

claude

Every prompt now draws from your free credit balance. No subscription required.


Frequently Asked Questions

How long does Claude Code take to install?

Installation takes 30-60 seconds via npm, assuming Node.js 18+ is already installed. If you need to install Node.js first, add 5-10 minutes. Verify success with claude --version.

Do I need a paid subscription to install Claude Code?

No, the installation is free. You only need a paid Anthropic subscription or API credits to actually use Claude Code. Free credits worth $1,000-$25,000+ via AI Perks eliminate the cost entirely.

Can I install Claude Code on multiple machines?

Yes, install on as many machines as you want. The installation itself is free. Your Anthropic account, API keys, and credits are shared across machines - usage from any machine counts toward the same balance.

How do I install Claude Code on a server (CI/CD)?

Use the same npm install command, then configure via environment variable (ANTHROPIC_API_KEY). For CI/CD, store the API key as a secret and inject it during pipeline execution. Free credits via AI Perks fund CI/CD usage at $0.

Can I install Claude Code without Node.js?

No, Claude Code requires Node.js 18+ to run. There are no standalone binaries officially distributed by Anthropic. Use nvm or your OS package manager to install Node.js if needed.

How do I install a specific version of Claude Code?

Install with the version flag: npm install -g @anthropic-ai/claude-code@1.2.0 (replace with desired version). See available versions in the GitHub changelog.

What happens after I install Claude Code?

Run claude --version to verify, then claude auth login (or set ANTHROPIC_API_KEY). Launch with claude from any project folder. Claude can read your code, suggest changes, and execute tasks. With free credits via AI Perks, unlimited usage costs $0.


Install Claude Code + Get Free Anthropic Credits

Installing Claude Code takes 30 seconds. Powering it for free takes a AI Perks subscription:

  • $1,000-$25,000+ in free Anthropic credits
  • Stacking strategies for $50,000+ runway
  • 200+ additional startup perks beyond AI credits
  • Updated guides for every Claude Code version

Subscribe at getaiperks.com →


Install Claude Code in 30 seconds. Power it for free at getaiperks.com.

AI Perks

AI Perks curates and provides access to exclusive discounts, credits, and deals on AI tools, cloud services, and APIs to help startups and developers save money.

AI Perks Cards

This content is for informational purposes only and may contain inaccuracies. Credit programs, amounts, and eligibility requirements change frequently. Always verify details directly with the provider.