ai-hub
[en]es
[tool][volatile][vClaude Code v2.1.148]

How to install Claude Code

Step-by-step guide to installing Claude Code on macOS, Linux, and Windows. Covers all installation methods, system requirements, and initial setup.

// 4 min read · updated 2026-05

Context

Claude Code is Anthropic's CLI tool that lets you work with Claude directly from your terminal. It edits files, runs commands, manages git workflows, and navigates your codebase through natural language instructions. It's available as a terminal CLI, VS Code extension, JetBrains plugin, desktop app, and GitHub Actions.

This article covers the CLI installation only. Claude Code requires a paid subscription (Pro, Max, Team, or Enterprise), an Anthropic Console account, or access through a cloud provider like Amazon Bedrock, Google Vertex AI, or Microsoft Foundry. The free Claude.ai plan does not include access.

Setup

System requirements

ResourceSpecification
OSmacOS 13.0+, Windows 10 1809+ / Server 2019+, Ubuntu 20.04+, Debian 10+, Alpine 3.19+
Architecturex64 or ARM64
RAM4 GB minimum
Disk500 MB free
NetworkInternet connection required
ShellBash, Zsh, PowerShell, or CMD
GitRecommended on Windows (Git for Windows). Usually pre-installed on macOS and Linux.

Required account

You need one of these account types:

  • Claude Pro, Max, Team, or Enterprise — recommended for individual or team use
  • Anthropic Console — API access with pre-paid credits
  • Amazon Bedrock, Google Vertex AI, or Microsoft Foundry — for enterprises with existing cloud infrastructure

Installation methods

This is the official method. The binary auto-updates in the background.

macOS, Linux, WSL:

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

Windows PowerShell:

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

Windows CMD:

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

After installation, the binary lives at ~/.local/bin/claude. If the claude command is not found, add that directory to your PATH:

# Zsh (macOS default)
echo 'export PATH="$PATH:$HOME/.local/bin"' >> ~/.zshrc
source ~/.zshrc
 
# Bash (Linux default)
echo 'export PATH="$PATH:$HOME/.local/bin"' >> ~/.bashrc
source ~/.bashrc

On Windows, the installer adds it to PATH automatically. If it doesn't work, add %USERPROFILE%\.local\bin to your system environment variables.

Homebrew (macOS)

brew install --cask claude-code

Homebrew offers two casks: claude-code (stable, ~1 week delay) and claude-code@latest (latest channel). Homebrew installations do not auto-update. To upgrade:

brew upgrade claude-code
# or
brew upgrade claude-code@latest

WinGet (Windows)

winget install Anthropic.ClaudeCode

Does not auto-update. Run winget upgrade Anthropic.ClaudeCode periodically.

npm

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

Requires Node.js 18+. The npm package pulls the native binary through per-platform optional dependencies. Do not use sudo npm install -g. To upgrade:

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

Note: While npm still works, Anthropic recommends the Native Install. The npm method does not auto-update and requires Node.js.

Linux package managers

# Debian/Ubuntu (apt)
sudo apt install claude-code
 
# Fedora/RHEL (dnf)
sudo dnf install claude-code
 
# Alpine (apk)
apk add claude-code

Authentication

Once installed, run claude from your terminal in your project directory:

cd my-project
claude

On first launch, a browser will open for you to sign in with your Anthropic account. Credentials are stored locally in ~/.claude/. If you're on a remote machine (SSH), press c at the login prompt to copy the auth URL and open it in your local browser.

To use an API key in headless environments (servers, Docker, CI/CD):

export ANTHROPIC_API_KEY=your-api-key
claude

Examples

Verify installation

claude --version

Should display the installed version (e.g., 2.1.148).

Diagnose issues

claude doctor

Runs an automated check of your installation health, configuration, MCP servers, and context usage.

First use

cd my-project
claude

Inside the interactive session you can start giving instructions directly:

> What does this project do?
> Explain the main function
> Add tests for the users module

Non-interactive use

claude -p "Give me a summary of the README"

Switch accounts

# Inside an interactive session
/login

Particularities

Auto-update: Only Native Install auto-updates. Homebrew, WinGet, and npm require manual commands.

Node.js: No longer a hard requirement. Native Install and system package managers install a standalone binary that doesn't need Node.js. Only the npm method requires Node.js 18+.

Windows: Git for Windows is strongly recommended so Claude Code can use the Bash tool. Without it, it will fall back to PowerShell. WSL users don't need Git for Windows.

Alpine Linux: The bundled ripgrep binary can fail on musl systems. If file search doesn't work, install ripgrep from the system and set the environment variable:

apk add ripgrep
export USE_BUILTIN_RIPGREP=0

Corporate proxy: If you're behind a proxy, set HTTP_PROXY and HTTPS_PROXY environment variables. The proxy can interfere with OAuth authentication.

Conflicting ANTHROPIC_API_KEY: If you have ANTHROPIC_API_KEY set in your shell profile (possibly from a previous project), Claude Code will use it instead of your subscription's OAuth credentials. If you see 400 "organization disabled" errors, check your ~/.zshrc, ~/.bashrc, or ~/.profile files and remove any export ANTHROPIC_API_KEY=... lines.

Uninstallation:

# Native Install
claude uninstall
 
# Homebrew
brew uninstall --cask claude-code
 
# npm
npm uninstall -g @anthropic-ai/claude-code

// related