In Lesson 1, you learned why Claude Code is revolutionary. Now comes the crucial step: getting it working on your machine.
This isn't just about following installation commands. It's about crossing the bridge from "interesting concept" to "tool I can actually use." By the end of this lesson, Claude Code will be installed, authenticated, and ready to assist with your development work.
This lesson covers the official Claude subscription setup (Pro $20/month or Max $200/month). If you prefer a free/minimal cost alternative, see Lesson 3: Free Claude Code Setup.
Both paths teach identical Claude Code skills (subagents, skills, MCP, hooks covered in this chapter).
Key difference: Official path uses Anthropic's Claude models. Free path lets you use Claude Code's agentic architecture with any LLM backend through production-grade API routing.
Before we begin, verify you have the following:
1. Terminal Access
2. Claude Account (one of the following):
3. System Requirements
4. Optional (for npm installation only)
Claude Code installation has been simplified with official installers for each platform. Choose your operating system tab below to see platform-specific installation methods.
⚠️ Important: Claude Code requires a bash-compatible shell to run. On Windows, you need either WSL or Git for Windows installed—the installer downloads Claude Code, but it runs inside a bash shell.
Decision Tree:
Why recommended: Full Linux environment, best compatibility, recommended by Anthropic.
Step 1: If you don't have WSL, install it first (run in PowerShell as Administrator):
Restart your computer after installation.
Step 2: Open your WSL terminal (Ubuntu) and run:
What this does: Downloads and executes the official installer script in your Linux environment.
Requirements: Windows 10 version 2004+ or Windows 11, WSL 1 or WSL 2
When to use: You want to run Claude Code natively on Windows without WSL.
Option A - PowerShell:
Option B - Command Prompt (CMD):
Requirements: Windows 10+, Git for Windows (provides the bash shell Claude Code needs)
Step 1: Install Git for Windows if not already installed.
Step 2: Run one of the install commands above.
Step 3: For portable Git installations, configure the bash path (run in PowerShell):
To make this permanent, add to your PowerShell profile:
Step 4: Run Claude Code:
What this does: The installer downloads Claude Code; Git for Windows provides the bash shell it runs in.
Windows Installation Guide
For a detailed step-by-step Windows installation guide with screenshots, see: Claude Code Installation for Windows
Open your shell (WSL terminal or Git Bash) and check your installation:
Expected output:
(Your version number will differ—Claude Code auto-updates frequently.)
"Explain the difference between WSL and Git Bash for Windows developers. When would you choose one over the other for AI-native development workflows?"
Decision Tree:
Why recommended: Official installer, works out of the box, no dependencies required.
Open Terminal and run:
What this does: Downloads and executes the official installer script.
Requirements: curl and bash (pre-installed on macOS)
When to use: You prefer managing packages through Homebrew for centralized updates.
Open Terminal and run:
What this does: Installs Claude Code using Homebrew's cask system (for GUI/binary applications). Installs to /Applications.
Requirements: Homebrew installed
Don't have Homebrew? Install it first:
Check your installation:
Expected output:
(Your version number will differ—Claude Code auto-updates frequently.)
Claude Code auto-updates itself, so you get the latest features without manual intervention. If you use Homebrew for other tools, brew install --cask claude-code integrates Claude Code into your existing workflow—but the native installer works equally well.
Decision Tree:
Why recommended: Universal, minimal dependencies, works on all major distributions.
Open your terminal and run:
What this does: Downloads and executes the official installer script, automatically detecting your distribution.
Requirements:
Supported Distributions:
Alpine Linux requires additional C++ runtime libraries:
What this does:
Make it permanent: Add export USE_BUILTIN_RIPGREP=0 to your shell profile (~/.bashrc or ~/.zshrc).
Check your installation:
Expected output:
(Your version number will differ—Claude Code auto-updates frequently.)
When to use this method:
Platforms: Windows, macOS, Linux, WSL
Open your terminal and run:
What this does: Installs Claude Code globally via npm package manager.
Requirements: Node.js 24 or later (includes npm)
Check Node.js version:
If you see v24.0.0 or higher, you're good to go.
"Explain the trade-offs between platform-specific installers (Homebrew, PowerShell) vs npm. When would a developer choose npm over the platform installer?"
Claude Code automatically checks for updates and prompts you to install them. To disable auto-updates (useful for corporate environments or version pinning):
macOS/Linux/WSL:
Add to your shell profile (~/.bashrc, ~/.zshrc, etc.) to make permanent.
Windows PowerShell:
Add to your PowerShell profile ($PROFILE) to make permanent.
Manual update check:
After installation, verify your system configuration:
What this checks:
Use this command if you encounter issues during installation or authentication.
In AI-native development, terminal comfort is a skill multiplier. The 5 minutes you invest learning basic terminal commands unlocks 10x productivity with AI tools. You're not becoming a "terminal expert"—you're removing the friction between intent and execution.
If you need to remove Claude Code (for reinstallation or troubleshooting):
macOS/Linux/WSL (Native Install):
Windows PowerShell:
Homebrew:
npm:
Optional: Remove Configuration Files
To also remove your settings and credentials:
macOS/Linux/WSL:
Windows PowerShell:
Once installed, Claude Code needs to authenticate with your Claude account. There are three authentication paths depending on your account type and use case.
Decision Tree:
If you have both subscription and Console API: Use Method 1 (Claude App)—it's simpler and provides unified access.
In AI-native development, authentication isn't just about access—it's about resource management. Claude.ai (subscription) vs Console API (pay-per-use) vs Enterprise (dedicated capacity) represents different cost models and usage patterns. Understanding your workflow determines which path saves money.
Who this is for: Users with Claude Pro ($20/month), Claude Max ($200/month), or Team subscriptions.
Benefits: Unified access across Claude web app and Claude Code, simpler authentication flow.
In your terminal, run:
Expected output:
Select Option 1. Your default browser opens to Claude.ai authentication. Log in, review permissions, and authorize.
Return to your terminal. You should see:
Test your setup:
Expected output: Claude responds confirming the connection works.
Ask your AI: "I just installed Claude Code. Create a simple 'Hello World' workflow that: (a) shows me Claude can read a file, (b) proposes a small change, (c) explains what it did. Use a safe test file."
Expected Outcome: Confidence that Claude Code can read, propose changes, and explain actions—plus understanding of the approval workflow.
Who this is for: Developers with Claude Console API credits but no Claude.ai subscription. Pay-per-use model based on token consumption.
Use case: API-first workflows, programmatic access, usage-based billing.
In your terminal, run:
Expected output:
Select Option 2. Go to https://console.anthropic.com/settings/keys, create an API key, copy it, and paste when prompted.
You should see:
Test your setup:
Expected output: Claude responds confirming the connection works.
⚠️ Important for Console API Users:
Who this is for: Enterprise customers using Amazon Bedrock, Google Vertex AI, or Anthropic Foundry (dedicated capacity).
Use case: Organizations with existing cloud infrastructure, compliance requirements, or dedicated capacity needs.
Platform Options:
Claude Code can authenticate with Claude via AWS Bedrock:
Requirements:
Configuration: Contact your Enterprise administrator for Bedrock configuration details specific to your organization.
Claude Code can authenticate with Claude via Google Cloud Vertex AI:
Requirements:
Configuration: Contact your Enterprise administrator for Vertex AI configuration details specific to your organization.
Claude Code can connect to dedicated Claude capacity via Anthropic Foundry:
Requirements:
Configuration: Contact your Anthropic Enterprise support for Foundry setup.
📚 Enterprise Documentation: For detailed enterprise configuration, see https://docs.anthropic.com/en/api/claude-on-amazon-bedrock or contact your Enterprise administrator.
Before moving forward, let's address important security considerations:
1. File System Access
2. Command Execution
3. Cost Management (Console API Users)
Now that Claude Code is installed, let's build confidence through safe exploration and establish good security practices.
🛡️ Establish Safety Boundaries:
"I just installed Claude Code and I'm nervous about file access and command execution. Help me set up safe boundaries: What directories should I AVOID running Claude Code in? What commands should I NEVER approve without careful review? Create a practical safety checklist I can follow until I'm more comfortable."
🎯 Practice First Commands:
"I completed installation successfully! Give me 3-5 safe 'Hello World' style prompts I can try RIGHT NOW that will: (a) verify Claude Code works, (b) won't modify important files, (c) demonstrate basic capabilities. Include what I should expect to see for each prompt."
🧪 Test Your Installation:
"Walk me through testing my Claude Code installation step-by-step. Start with checking the version, then test file reading (on a safe test file), then test a simple command execution (like checking current directory). Explain what each output means and how to know if something's wrong."
🚀 Configure for Your Workflow:
"I work primarily with [describe your tech stack: Python/JavaScript/Go/etc.]. Help me verify Claude Code can handle my environment: check for required tools, test reading my project structure, and suggest first productive task I could try that's relevant to my actual work."