4.3 KiB
4.3 KiB
Claude Code CLI - Installation and Setup
System Requirements
Hardware Requirements
| Component | Minimum | Recommended |
|---|---|---|
| Processor | Dual-core 1.6 GHz | Quad-core 2.4 GHz or better |
| RAM | 4 GB | 8 GB or more |
| Disk Space | 500 MB free | 1 GB or more free |
| Network | Broadband connection | High-speed broadband connection |
Software Requirements
| Component | Requirement | Notes |
|---|---|---|
| Operating System | macOS 10.15+ or Linux (Ubuntu 18.04+, Debian 10+, etc.) | Windows not supported directly (requires WSL) |
| Node.js | v18.0.0 or higher | LTS version recommended |
| npm | v7.0.0 or higher | Included with Node.js |
| Git | Any recent version | Required for version control features |
Installation Methods
Global Installation (Recommended)
npm install -g @anthropic-ai/claude-code
This will install Claude Code globally, making the claude command available throughout your system.
Project-Specific Installation
cd your-project-directory
npm install @anthropic-ai/claude-code
When installed locally, you can run it using:
npx claude
Installation Verification
To verify the installation was successful:
claude --version
This should display the current version of Claude Code.
First-Time Setup
Authentication Setup
- Run
claudein your terminal - You will be prompted to authenticate with Anthropic
- A browser window will open for OAuth authentication
- Sign in with your Anthropic Console account
- Grant the requested permissions
- Return to the terminal where authentication will be confirmed
Workspace Configuration
Claude Code automatically recognizes and works with existing project structures, including:
- Git repositories
- npm/yarn projects
- Standard directory layouts for common frameworks
No additional configuration is typically required.
Optional Configuration
A configuration file can be created at ~/.claude-code/config.json with the following structure:
{
"telemetry": true,
"logLevel": "info",
"maxHistorySize": 1000,
"theme": "dark",
"editor": {
"preferredLauncher": "code"
},
"git": {
"preferredRemote": "origin"
}
}
Environment Configuration
Environment Variables
| Variable | Purpose | Default |
|---|---|---|
CLAUDE_API_KEY |
Override API key | OAuth-provided token |
CLAUDE_CONFIG_PATH |
Custom config location | ~/.claude-code/config.json |
CLAUDE_LOG_LEVEL |
Set logging verbosity | info |
CLAUDE_TELEMETRY |
Enable/disable telemetry | true |
CLAUDE_WORKSPACE |
Default workspace | Current directory |
Proxy Configuration
Claude Code respects standard proxy environment variables:
HTTP_PROXY/http_proxyHTTPS_PROXY/https_proxyNO_PROXY/no_proxy
Update Procedures
Manual Update
npm update -g @anthropic-ai/claude-code
Automatic Update Checking
Claude Code checks for updates on startup and notifies when a new version is available.
Version Rollback
If needed, you can install a specific version:
npm install -g @anthropic-ai/claude-code@0.2.28
Troubleshooting
Common Installation Issues
| Issue | Possible Cause | Resolution |
|---|---|---|
| Permission errors | Insufficient npm permissions | Use sudo or fix npm permissions |
| Node version error | Outdated Node.js | Update Node.js to v18+ |
| Command not found | Path issues | Check PATH environment variable |
| Installation hangs | Network issues | Check network connection, try with --verbose |
Diagnostic Commands
# Check Node.js version
node --version
# Check npm version
npm --version
# Verify Claude installation
which claude
# Check Claude version
claude --version
# Run with verbose logging
claude --verbose
Support Resources
- GitHub issues: https://github.com/anthropics/claude-code/issues
- Documentation: https://docs.anthropic.com/en/docs/agents/claude-code/introduction
Uninstallation
Complete Removal
npm uninstall -g @anthropic-ai/claude-code
rm -rf ~/.claude-code
Preserving Configuration
npm uninstall -g @anthropic-ai/claude-code
# Configuration remains in ~/.claude-code for future installations