Installation Guide
What you'll learn in this chapter: Prerequisites for Claude Code, OS-specific installation steps, and how to verify your installation
Before starting this chapter, you'll need:
- An internet connection
- Basic familiarity with a terminal (Command Prompt / PowerShell / Terminal)
System Requirements
| Requirement | Minimum |
|---|---|
| macOS | 13.0 (Ventura) or later |
| Windows | 10 (1809) or later + Git for Windows |
| Linux | Ubuntu 20.04+ / Debian 10+ or other glibc-based distros |
| RAM | 4GB or more |
| Shell | Bash, Zsh, PowerShell, or CMD |
The native install (recommended) does not require Node.js. Node.js is only needed for the legacy npm install method.
Installing Claude Code
Method 1: Native Install (Recommended)
Supports auto-updates and does not require Node.js.
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
Windows requires Git for Windows. Install it first if you don't have it.
Method 2: Package Manager
Homebrew (macOS):
brew install --cask claude-code
WinGet (Windows):
winget install Anthropic.ClaudeCode
Homebrew/WinGet installs do not auto-update. Run brew upgrade claude-code or winget upgrade Anthropic.ClaudeCode to update manually.
Legacy: npm Install (Not Recommended)
Requires Node.js 18+. Native install is recommended instead.
npm install -g @anthropic-ai/claude-code
The
-gflag installs globally, so you can use theclaudecommand from any directory.
Verifying the Installation
claude --version
Expected output (the version number may vary depending on when you install):
1.x.x (Claude Code)
For more detailed diagnostics:
claude doctor
First Run and Login
cd your-project
claude
On first launch, a browser window opens with a login page:
- Claude.ai account (Pro/Max/Team/Enterprise), or
- Anthropic Console account (API billing)
Log in to complete authentication.
Claude Code is available on Pro, Max, Team, and Enterprise paid plans. The free plan is not supported. API key authentication is also available — see the next chapter for details.
Common Installation Issues
Issue 1: claude: command not found
Close and reopen your terminal completely to refresh the PATH environment variable. If that doesn't work, the install path is missing from your PATH.
Diagnosis:
# Check where claude is located in PowerShell
Get-Command claude -ErrorAction SilentlyContinue
# If nothing appears → PATH issue confirmed. Find where it was installed:
Get-ChildItem -Path $env:USERPROFILE -Recurse -Filter claude.exe -ErrorAction SilentlyContinue
Add to PATH (PowerShell):
$currentPath = [Environment]::GetEnvironmentVariable('PATH', 'User')
[Environment]::SetEnvironmentVariable('PATH', "$currentPath;$env:USERPROFILE\.local\bin", 'User')
After adding to PATH, you must close PowerShell completely and reopen it. Otherwise the same error will persist.
On macOS/Linux, if you encounter the same issue:
echo 'export PATH="$HOME/.local/bin:$PATH"' >> ~/.zshrc # macOS
echo 'export PATH="$HOME/.local/bin:$PATH"' >> ~/.bashrc # Linux
source ~/.zshrc # or source ~/.bashrc
If the problem persists, run claude doctor for detailed diagnostics.
Issue 2: EACCES: permission denied (macOS/Linux, npm install)
mkdir ~/.npm-global
npm config set prefix ~/.npm-global
echo 'export PATH=~/.npm-global/bin:$PATH' >> ~/.bashrc
source ~/.bashrc
npm install -g @anthropic-ai/claude-code
This issue does not occur with the native install method.
Issue 3: Installation fails on a corporate network
You may need to configure a proxy:
# For npm install
npm config set proxy http://your-proxy-address:port
npm config set https-proxy http://your-proxy-address:port
Issue 4: Windows PowerShell execution policy error
# Open PowerShell as Administrator and run
Set-ExecutionPolicy -ExecutionPolicy RemoteSigned -Scope CurrentUser
Key Takeaways
- Native install is recommended — no Node.js required, auto-updates included
- macOS/Linux:
curl ... | bash/ Windows:irm ... | iex - Verify with
claude --version - First run authenticates via browser login
- Paid plan (Pro/Max/Team/Enterprise) required
Get weekly Claude Code tips by email — real usage insights, delivered free. Subscribe →