Issue 02 | Environment Setup and Authorization: Windows/Mac/Linux Rapid Installation Guide
🎯 Learning Objectives
By the end of this issue, you will be able to:
- Successfully install Claude Code on Mac / Windows / Linux
- Complete terminal authentication and authorization
- Start a Claude Code session in your first project
📖 Core Concepts Explained
2.1 Installation Methods Overview
Claude Code offers various installation methods, adapting to different operating systems and scenarios:
| Installation Method | Platform | Applicable Scenario |
|---|---|---|
| Native Install (Recommended) | Mac / Linux / Windows | Automatic updates, most stable |
| Homebrew | Mac | Homebrew user preference |
| WinGet | Windows | Windows package manager |
| VS Code Extension | All Platforms | Integrated within IDE |
| Desktop App | Mac / Windows | GUI interface preference |
| Web Version | All Platforms | No installation required |
2.2 Subscription Plans
Using Claude Code requires a paid subscription:
| Plan | Price | Target Audience |
|---|---|---|
| Pro | $20/month | Daily development, light usage |
| Max 5x | $100/month | Daily intensive development |
| Max 20x | $200/month | Professional teams/heavy users |
| API (Console) | Pay-as-you-go | Integration into automation pipelines |
💻 Code Demo: Three-Step Installation
Mac / Linux Installation
# Step 1: One-click installation (recommended method)
curl -fsSL https://claude.ai/install.sh | bash
# Step 2: Verify installation
claude --version
# Output: Claude Code v2.3.0
# Step 3: Authenticate login
claude auth login
Windows Installation (PowerShell)
# Step 1: One-click installation
irm https://claude.ai/install.ps1 | iex
# Step 2: Verify
claude --version
# Step 3: Authenticate
claude auth login
Homebrew Installation (Mac Alternative)
# Install
brew install --cask claude-code
# Upgrade
brew upgrade claude-code
💻 Simulate Claude TUI Interaction: First Launch
$ cd ~/my-project
$ claude
╭──────────────────────────────────────────────────────╮
│ │
│ Welcome to Claude Code v2.3.0! │
│ │
│ You need to sign in to continue. │
│ Press Enter to open the browser for authentication │
│ │
╰──────────────────────────────────────────────────────╯
↵ Enter
✓ Browser opened. Waiting for authentication...
✓ Successfully authenticated as [email protected]
✓ Plan: Max (5x)
╭──────────────────────────────────────────────────────╮
│ │
│ Claude Code is ready! │
│ │
│ 📁 Working directory: ~/my-project │
│ 📄 Found: package.json, tsconfig.json │
│ 📝 No CLAUDE.md found (run /init to create one) │
│ │
│ What can I help you with? │
│ │
│ Tips: │
│ • Press Shift+Tab to switch modes │
│ • Type /help for available commands │
│ • Type /init to set up project memory │
│ │
╰──────────────────────────────────────────────────────╯
> /help
╭─ Available Commands ────────────────────────────────╮
│ │
│ /help Display help information │
│ /init Initialize CLAUDE.md project memory │
│ /clear Clear current context │
│ /compact Compress long sessions into a summary│
│ /memory View/edit auto-memory │
│ /permissions Manage tool permissions │
│ /agents View available sub-agents │
│ /schedule Create scheduled tasks │
│ /desktop Switch to desktop application │
│ /loop Repeat prompt execution │
│ /teleport Pull session from Web client │
│ │
╰──────────────────────────────────────────────────────╯
💻 Code Demo: Authentication Status Check
# Check current authentication status
claude auth status
# Output example:
# ✓ Authenticated
# Account: [email protected]
# Plan: Max (5x usage)
# Organization: Personal
# Logout (use when switching accounts)
claude auth logout
# Authenticate using API Key (CI/CD scenarios)
claude auth login --console
🔧 Involved CLI Commands
| Command | Function | Official Documentation |
|---|---|---|
claude |
Start interactive session | CLI Reference |
claude auth login |
Login authentication | Supports --email, --sso, --console parameters |
claude auth status |
View authentication status | |
claude auth logout |
Logout | |
claude --version |
View version | |
claude update |
Update to the latest version |
⚠️ Common Troubleshooting
Problem 1: claude command not found after installation
# Mac/Linux: Add Claude Code to PATH
export PATH="$HOME/.claude/bin:$PATH"
# For permanent effect
echo 'export PATH="$HOME/.claude/bin:$PATH"' >> ~/.zshrc
source ~/.zshrc
Problem 2: Authentication window cannot open
# Manually authenticate using Console method
claude auth login --console
# It will output a URL, open it manually in your browser
Problem 3: Windows PowerShell reports && error
# Windows CMD and PowerShell have different syntax
# If an error occurs, use Git Bash or WSL to run the installation script
📝 Key Takeaways from this Issue
- It is recommended to use the Native Install method for installation (automatic updates)
- First-time use requires completing OAuth authentication in the browser
- Use
claude auth statusto check authentication status at any time - For CI/CD environments, use
claude auth login --consolefor API Key authentication - Remember common slash commands:
/help,/init,/clear,/compact