Step-by-step Claude Code installation for all platforms. Mac, Windows, Linux setup instructions, requirements, authentication, and first run guide.
Claude Code Setup & Installation Guide
Getting Claude Code running is straightforward. This guide covers installation on Mac, Windows, and Linux—plus authentication and your first successful session.
Requirements
Before installing:
System Requirements
- Node.js: Version 18 or higher
- npm: Comes with Node.js
- Terminal: Any terminal application
- Internet: Required for API calls
Account Requirements
- Claude Pro subscription: $20/month at claude.ai
- Required for Claude Code access
- Free tier doesn't include CLI access
Mac Installation
Step 1: Install Node.js
Option A: Official Installer
Download from nodejs.org and run the installer.
Option B: Homebrew (Recommended)
brew install node
Verify installation:
node --version # Should show v18+
npm --version # Should show 9+
Step 2: Install Claude Code
npm install -g @anthropic-ai/claude-code
If you get permission errors:
sudo npm install -g @anthropic-ai/claude-code
Step 3: Authenticate
claude
First run opens your browser for authentication. Log in with your Claude Pro account.
Step 4: Verify
claude --version
You're ready to go.
Windows Installation
Step 1: Install Node.js
Download the Windows installer from nodejs.org.
Run the installer with default options.
Verify in PowerShell or Command Prompt:
node --version
npm --version
Step 2: Install Claude Code
Open PowerShell as Administrator:
npm install -g @anthropic-ai/claude-code
Step 3: Authenticate
claude
Browser opens for authentication. Sign in with Claude Pro account.
Step 4: Verify
claude --version
Windows-Specific Notes
- Use PowerShell or Windows Terminal (not cmd.exe for best experience)
- WSL2 also works if you prefer Linux environment
- Git Bash is supported
Linux Installation
Ubuntu/Debian
Install Node.js:
curl -fsSL https://deb.nodesource.com/setup_20.x | sudo -E bash -
sudo apt-get install -y nodejs
Install Claude Code:
npm install -g @anthropic-ai/claude-code
If permission errors occur:
mkdir ~/.npm-global
npm config set prefix '~/.npm-global'
echo 'export PATH=~/.npm-global/bin:$PATH' >> ~/.bashrc
source ~/.bashrc
npm install -g @anthropic-ai/claude-code
Fedora/RHEL
sudo dnf install nodejs
npm install -g @anthropic-ai/claude-code
Arch Linux
sudo pacman -S nodejs npm
npm install -g @anthropic-ai/claude-code
Authenticate
claude
Authentication
First-Time Setup
When you run claude for the first time:
- Browser opens automatically
- Log in to your Claude account
- Authorize Claude Code
- Return to terminal
- Claude Code is ready
Manual Authentication
If automatic auth fails:
claude login
Re-authentication
If you need to re-authenticate:
claude logout
claude login
Checking Auth Status
claude auth status
First Run
Navigate to Your Project
cd /path/to/your/project
claude
Try a Simple Command
> Explain the structure of this project
Test File Operations
> Create a simple hello.py file that prints "Hello, World!"
Review the proposed file, type y to accept.
Verify It Works
> Run the hello.py file
If everything works, you're set up correctly.
Configuration
Project Configuration
Create .claude/config.json in your project:
{
"instructions": "This is a Next.js project. Use TypeScript strict mode.",
"model": "sonnet",
"ignore": ["node_modules", "dist", ".git"]
}
Global Configuration
Located at ~/.claude/config.json:
{
"default_model": "sonnet",
"theme": "dark"
}
Ignore File
Create .claudeignore to exclude files from context:
node_modules/
dist/
build/
*.log
.env
*.min.js
Troubleshooting Installation
"command not found"
Problem: Terminal doesn't recognize claude command.
Solutions:
- Check npm global bin is in PATH:
npm bin -g
- Add to PATH manually:
export PATH=$(npm bin -g):$PATH
- Reinstall:
npm uninstall -g @anthropic-ai/claude-code
npm install -g @anthropic-ai/claude-code
Permission Errors
Problem: EACCES errors during install.
Mac/Linux Solution:
mkdir ~/.npm-global
npm config set prefix '~/.npm-global'
export PATH=~/.npm-global/bin:$PATH
npm install -g @anthropic-ai/claude-code
Windows Solution:
Run PowerShell as Administrator.
Node Version Too Old
Problem: Requires Node 18+, you have older version.
Solution:
Use nvm (Node Version Manager):
# Mac/Linux
curl -o- https://raw.githubusercontent.com/nvm-sh/nvm/v0.39.0/install.sh | bash
nvm install 20
nvm use 20
# Windows (use nvm-windows)
# Download from https://github.com/coreybutler/nvm-windows
Authentication Failed
Problem: Browser auth doesn't complete.
Solutions:
- Check you have Claude Pro subscription
- Try manual login:
claude login
- Clear stored credentials:
rm -rf ~/.claude
claude
- Check network/firewall isn't blocking api.anthropic.com
Slow or No Response
Problem: Claude Code hangs or takes forever.
Solutions:
- Check internet connection
- Verify API is reachable:
ping api.anthropic.com
- Disable VPN (some VPNs block API calls)
- Try during off-peak hours
Updating Claude Code
Check Current Version
claude --version
Update to Latest
npm update -g @anthropic-ai/claude-code
Check for Updates
npm outdated -g @anthropic-ai/claude-code
Uninstalling
If you need to uninstall:
npm uninstall -g @anthropic-ai/claude-code
rm -rf ~/.claude # Remove configuration
IDE Integration
While Claude Code is terminal-based, you can use it alongside your IDE:
VS Code
Open integrated terminal (Ctrl+) and run claude`.
JetBrains IDEs
Open terminal tab and run claude.
Vim/Neovim
Split terminal or use tmux alongside your editor.
Quick Start Commands
Once installed, here are essential commands:
| Command |
Purpose |
claude |
Start interactive session |
claude -p "prompt" |
One-off question |
claude --continue |
Resume last session |
claude --version |
Check version |
claude logout |
Sign out |
claude login |
Sign in |
Next Steps
After installation:
- Try a real project: Navigate to an existing codebase
- Ask questions: "Explain how this works"
- Make changes: "Add error handling to this function"
- Explore commands: Type
/help in a session
Claude Code works best when you have a real project to work on.
Need help with Claude Code setup or AI development tools? Cedar Operations provides support and training. Book a consultation →
Related reading: