Claude Code is Anthropic’s command-line AI coding assistant. It runs directly in your terminal and helps you understand code, write features, fix bugs, and manage Git workflows using natural language. This guide covers every current installation method for Windows, macOS, and Linux, plus fixes for the most common errors people hit during setup.

Table of Contents
System Requirements
Before installing, confirm your system meets these requirements.
| Requirement | Details |
|---|---|
| macOS | 13.0 (Ventura) or newer |
| Windows | Windows 10 (1809+) or Windows Server 2019+ |
| Linux | Ubuntu 20.04+, Debian 10+, or Alpine Linux 3.19+ |
| RAM | 4 GB minimum |
| Shell | Bash or Zsh recommended |
| Internet | Required for login and all usage |
| Account | Claude Pro, Max, Teams, Enterprise, or Console with billing |
Important: The free Claude.ai plan does not include Claude Code. You need a paid account. Claude Pro ($20/month) works for most developers. Claude Max ($100–200/month) adds higher rate limits for heavier usage.
Installation Methods
There are four supported ways to install Claude Code. The native installer is the fastest for most users.
| Method | Platform | Auto-updates |
|---|---|---|
| Native installer | Windows, macOS, Linux, WSL | Yes |
| Homebrew | macOS, Linux | No (manual upgrade) |
| WinGet | Windows | No (manual upgrade) |
| npm | All platforms | No (deprecated) |
Method 1: Native Installer (Recommended)
The native installer is the fastest option. It requires no Node.js, handles dependencies automatically, and keeps Claude Code updated in the background.
macOS and Linux
curl -fsSL https://claude.ai/install.sh | bashWindows (PowerShell)
irm https://claude.ai/install.ps1 | iexWindows (Command Prompt)
curl -fsSL https://claude.ai/install.cmd -o install.cmd && install.cmd && del install.cmdWindows users: If you see The token '&&' is not a valid statement separator, you are in PowerShell, not CMD. Use the PowerShell command above instead. If you see 'irm' is not recognized as an internal or external command, you are in CMD, not PowerShell. Your prompt shows PS C:\ in PowerShell and C:\ without the PS prefix in CMD.
Git for Windows required: Native Windows installation requires Git for Windows. Install it from git-scm.com before running the installer if you do not already have it. WSL users do not need it.
Method 2: Homebrew (macOS and Linux)
Homebrew offers two casks depending on how you want to handle updates.
# Stable channel (typically one week behind, skips major regressions)
brew install claude-code
# Latest channel (new versions as soon as they ship)
brew install claude-code@latestNote: Homebrew installations do not auto-update. Run brew upgrade claude-code or brew upgrade claude-code@latest periodically to get the latest features and security fixes.
Method 3: WinGet (Windows)
winget install Anthropic.ClaudeCodeNote: WinGet installations do not auto-update. Run winget upgrade Anthropic.ClaudeCode periodically to stay current.
Method 4: npm (Deprecated)
npm installation still works but is no longer the recommended method. Use the native installer instead. If you need to pin a specific version or work in an environment where npm is the standard package manager, this method remains available.
npm install -g @anthropic-ai/claude-codeThis requires Node.js 18.0 or higher. If you see EACCES permission errors, do not use sudo. Fix npm permissions properly instead.
Windows Setup: WSL vs Native
You can run Claude Code on Windows in two supported ways.
WSL (recommended for most developers)
- Works with WSL 1 and WSL 2
- WSL 2 provides better sandboxing and security
- Use the macOS/Linux install command inside WSL
- Node.js must be installed inside the WSL environment, not just on the Windows side if using npm
Native Windows (Git Bash)
- Requires Git for Windows installed first
- If Git Bash is not detected automatically, set the path manually:
$env:CLAUDE_CODE_GIT_BASH_PATH="C:\Program Files\Git\bin\bash.exe"How to Log In After Installation
Claude Code requires account authentication on first launch.
claudeOn first run, Claude Code opens your browser for OAuth login. After authenticating, your session token is stored locally and you will not need to log in again.
Supported account types:
- Claude Pro or Max plan
- Claude Teams or Enterprise
- Claude Console with active billing
- Amazon Bedrock, Google Vertex AI, or Microsoft Foundry (enterprise cloud providers)
For servers, containers, or CI pipelines where you cannot open a browser, use an API key instead:
export ANTHROPIC_API_KEY=sk-ant-your-key-here
claudeVerify Your Installation
After installing, run these two commands to confirm everything is working.
claude --version
claude doctorclaude doctor checks your authentication status, PATH configuration, dependencies, and installation type. Green checkmarks across all items means you are ready to use Claude Code.
Set Up Your First Project (CLAUDE.md)
This step is missing from most install guides. After installation, navigate to any project and create a CLAUDE.md file. Claude Code reads this file automatically every time it starts in that directory. Use it to describe your project structure, coding conventions, and preferred workflows.
cd your-project
claudeThen ask Claude to generate one for you:
Generate a CLAUDE.md file for this projectThis single file significantly improves how Claude Code understands and works within your codebase.
Basic Commands
claude # Start interactive mode
claude "task" # Run a one-time task
claude -p "query" # Ask a quick question and exit
claude commit # Create a Git commit
/help # Show available commands
/clear # Clear conversation history
/doctor # Run diagnosticsAuto-Updates and Release Channels
Native installations update automatically in the background. Homebrew and WinGet require manual upgrades.
Available channels:
latest(default) — new features as soon as they releasestable— slightly older, fewer breaking changes
Switch channels by editing your settings:
{
"autoUpdatesChannel": "stable"
}Disable auto-updates entirely:
export DISABLE_AUTOUPDATER=1Common Install Errors and Fixes
“The token ‘&&’ is not a valid statement separator”
You ran the CMD command in PowerShell. Use the PowerShell command instead:
irm https://claude.ai/install.ps1 | iex“‘irm’ is not recognized as an internal or external command”
You ran the PowerShell command in CMD. Use the CMD command instead or open PowerShell.
claude: command not found (after install)
Your PATH is not updated. Run this and restart your terminal:
echo 'export PATH="$HOME/.local/bin:$PATH"' >> ~/.bashrc
source ~/.bashrcOn Zsh (macOS default):
echo 'export PATH="$HOME/.local/bin:$PATH"' >> ~/.zshrc
source ~/.zshrcEACCES permission error (npm method)
Do not run npm install -g with sudo. Fix npm permissions instead by setting a custom global directory, or switch to the native installer to avoid this entirely.
Git for Windows not found (native Windows)
Install Git for Windows from git-scm.com, then re-run the installer. Alternatively, set the Git Bash path manually:
$env:CLAUDE_CODE_GIT_BASH_PATH="C:\Program Files\Git\bin\bash.exe"Authentication fails or browser does not open
For headless environments, use an API key:
export ANTHROPIC_API_KEY=sk-ant-your-key-hereFor interactive sessions, confirm your account has an active paid plan. The free Claude.ai plan does not include Claude Code access.
How to Uninstall Claude Code
macOS, Linux, WSL
rm -f ~/.local/bin/claude
rm -rf ~/.local/share/claudeWindows (PowerShell)
Remove-Item "$env:USERPROFILE\.local\bin\claude.exe" -Force
Remove-Item "$env:USERPROFILE\.local\share\claude" -Recurse -ForceHomebrew
brew uninstall claude-codeWinGet
winget uninstall Anthropic.ClaudeCodeFAQs
Do I need Node.js to install Claude Code?
Not with the native installer or Homebrew. The native installer is dependency-free. Node.js 18+ is only required if you use the npm method, which is now deprecated.
Is the free Claude.ai plan enough?
No. Claude Code requires a paid plan. Claude Pro at $20/month is the minimum. Claude Max at $100–200/month is better for heavy daily use due to higher rate limits.
Can I use Claude Code on Windows without WSL?
Yes, via native Windows installation with Git for Windows, or via WinGet. WSL is recommended for a better experience but is not required.
How do I update Claude Code?
Native installer: updates happen automatically in the background. Homebrew: run brew upgrade claude-code. WinGet: run winget upgrade Anthropic.ClaudeCode. npm: run npm update -g @anthropic-ai/claude-code.
Why is npm install deprecated?
Anthropic moved to a native installer in early 2026 to remove the Node.js dependency and simplify the install process. The npm method still works but will not receive priority support going forward.
What is CLAUDE.md?
A project-specific file that Claude Code reads automatically on startup. It lets you define your project structure, conventions, and preferences so Claude Code understands your codebase from the first session.
