Claude Code is an agentic coding tool from Anthropic that lives in your terminal. It understands your codebase, executes routine tasks, explains complex code, and handles git workflows - all through natural language commands.
Prerequisites
Before installing Claude Code, ensure you have:
- A Claude subscription (Pro or Max recommended) OR an Anthropic account with billing enabled
- At least 4GB of RAM
- Terminal access (Terminal on macOS, PowerShell/CMD on Windows)
Installing on macOS
macOS has three installation options, with the native installer being recommended.
Option 1: Install Script (Recommended)
The easiest method - no Node.js required:
curl -fsSL https://claude.ai/install.sh | bash
The installer is signed by "Anthropic PBC" and notarized by Apple.
Option 2: Homebrew
If you prefer Homebrew:
brew install --cask claude-code
Note: Homebrew installations do not auto-update. Run brew upgrade claude-code to update manually.
Option 3: npm (Deprecated)
The npm method is deprecated but still works:
npm install -g @anthropic-ai/claude-code
If you have an existing npm installation, migrate to native by running:
claude install
Installing on Windows
Windows now supports native installation without WSL (as of version 2.x).
Option 1: PowerShell Script (Recommended)
Open PowerShell and run:
irm https://claude.ai/install.ps1 | iex
This installs Claude Code natively on Windows - no WSL required.
Option 2: WinGet
If you prefer WinGet:
winget install Anthropic.ClaudeCode
Note: WinGet installations do not auto-update. Run winget upgrade Anthropic.ClaudeCode to update manually.
Option 3: WSL (Optional)
While no longer required, WSL 2 still provides benefits:
- Sandboxing support for enhanced security (WSL 1 does not support sandboxing)
- Better compatibility with Unix-based tooling
To install in WSL:
-
Open your WSL terminal
-
Run the install script:
curl -fsSL https://claude.ai/install.sh | bash
Option 4: npm (Deprecated)
npm install -g @anthropic-ai/claude-code
Authentication
After installation, authenticate with your Anthropic account:
- Start Claude Code:
claude
- Follow the browser authentication flow to sign in with your Claude.ai account
Subscription Options
- Claude Pro/Max (Recommended): Subscribe at claude.ai for a unified subscription that includes both Claude Code and Claude on the web
- Anthropic API: Alternatively, use an Anthropic account with billing enabled and API credits
Verify Installation
After authentication, verify your installation:
claude --version
Run the diagnostic tool to check for issues:
claude doctor
This shows your installation type, version, and any potential problems.
Basic Usage
Navigate to your project directory and start Claude Code:
claude
Common tasks:
# Ask questions about your codebase
claude "explain how the authentication system works"
# Generate code
claude "write unit tests for the user service"
# Handle git workflows
claude "create a commit for my changes with a descriptive message"
# Refactor code
claude "refactor this function to use async/await"
Updating Claude Code
Native installations auto-update by default. For package manager installations:
Homebrew:
brew upgrade claude-code
WinGet:
winget upgrade Anthropic.ClaudeCode
Migrating from npm to native:
claude install
Troubleshooting
"command not found: claude"
If the command is not found after installation:
- Close and reopen your terminal
- Check if the installation completed successfully
- Try running the install script again
Authentication Issues
If you cannot authenticate:
- Verify your Claude subscription is active at claude.ai
- Clear any cached credentials and try again
- Check your internet connection
Running claude doctor
The claude doctor command helps diagnose issues:
claude doctor
This checks:
- Installation type (native vs npm)
- Version information
- Authentication status
- System compatibility
Windows-Specific Issues
If you encounter issues on native Windows:
- Ensure you are using PowerShell (not Command Prompt) for the install script
- Try running PowerShell as Administrator
- Consider using WSL 2 for sandboxing support
Next Steps
- Read the official Claude Code documentation
- Explore the GitHub repository
- Install GitHub Copilot CLI for another coding assistant
- Learn how to orchestrate multiple AI tools using Claude as an Engineering Manager