Installation and Setup
System Requirements
Before installing Claude Code, ensure your system meets these requirements:
Operating System
- ✅ Linux (Recommended)
- ✅ macOS (Recommended)
- ✅ Windows (via WSL2)
Runtime Environment (Choose One)
Option 1: Node.js Environment
- Node.js 18.0.0 or higher
- npm or yarn package manager
Option 2: Standalone Executable
- No Node.js required
- Download platform-specific binary directly
Other Requirements
- At least 2GB available memory
- Stable internet connection (for API calls)
- Command-line terminal (Terminal/iTerm2/Windows Terminal, etc.)
- Anthropic API Key (detailed in API Configuration)
Installation Methods
Claude Code offers multiple installation methods—choose the one that suits you best:
Method 1: Install via npm (Recommended)
Benefits: Easy updates, cross-platform, automatic dependency management
Method 2: Native Install Script (No Node.js Required)
Benefits: No Node.js dependency, picks the right binary for your platform, self-updating
macOS / Linux / WSL:
Windows (PowerShell):
Method 3: IDE Extensions and Desktop App
Beyond the CLI, Claude Code is also available as:
- VS Code extension: Search "Claude Code" in the VS Code marketplace and use it directly from the editor sidebar
- JetBrains plugin: Supports IntelliJ IDEA, PyCharm, WebStorm, and more
- Desktop app: macOS and Windows desktop clients, convenient for managing multiple parallel sessions
Note: There is no official
brew install claude-codeformula, and Claude Code cannot be built from source (the anthropics/claude-code repository is mainly for issue tracking and documentation). Use npm or the native install script above.
First Run
After installation, let's perform first-run configuration:
Step 1: Start in a Project Directory
On first run, Claude Code will guide you through:
- Choosing a UI theme (dark/light, etc.)
- Logging in: either with a Claude subscription account (Pro/Max plan, browser OAuth) or an Anthropic Console account (pay-per-use API billing)
- Trusting the current directory: confirm that Claude Code may read the project's files
Step 2: Login Options
The two login methods differ as follows:
You can also skip the login flow and provide an API key via environment variable:
Note: If you don't have an API Key yet, see the next chapter (API Configuration) for how to obtain one.
Step 3: Start Using It
Configuration File Locations
Claude Code configuration files are stored at:
Edit Configuration
Basic Configuration Options
Open ~/.claude/settings.json; common options look like this:
Main Configuration Options
See the official settings documentation for the full list.
Troubleshooting
Issue 1: Command Not Found
Error Message:
Solution:
Issue 2: Invalid API Key
Error Message:
Solution:
- Verify API Key format (should start with
sk-ant-) - Check if Key has expired
- Confirm account has sufficient balance
- Log in again or update the key:
Issue 3: Network Connection Issues
Error Message:
Solution:
Issue 4: Permission Issues
Error Message:
Solution:
Issue 5: Node.js Version Too Low
Error Message:
Solution:
Verify Installation
After installation, run these commands to verify everything works:
Expected Output:
Updating Claude Code
Keep Claude Code updated for latest features and fixes:
npm Update
Native Install Update
View Changelog
See the official repository's CHANGELOG.
Uninstallation
To uninstall Claude Code:
npm Uninstall
Native Install Uninstall
Summary
In this chapter, we learned:
- ✅ Claude Code's system requirements and runtime environment
- ✅ Installation methods: npm, native install script, IDE extensions, and desktop app
- ✅ First-run configuration process
- ✅ Configuration file locations and basic options
- ✅ Troubleshooting common issues
- ✅ Installation verification, updates, and uninstallation
You've now successfully installed Claude Code!
Next Step: Continue with API Configuration to obtain and configure your Anthropic API Key.