# Installation

> ⚡ **Recommended: one-click setup** — a single command does everything on this page (endpoint speed test, config, Node.js / Claude Code install, connectivity check; no sudo). Keep reading for manual installation.

```bash
# macOS / Linux
curl -fsSL https://qcode.cc/install/claude-code.sh | bash
```

```powershell
# Windows PowerShell
irm https://qcode.cc/install/claude-code.ps1 | iex
```

> See [One-Click Setup Script](/docs/getting-started/one-click-install) for flags, troubleshooting and rollback.

> 📖 Wondering what to put in `ANTHROPIC_BASE_URL`, or which of the four access domains to pick? See [Endpoints & API Paths](./endpoints-and-api-paths).

Follow this guide to easily install and use Claude Code on your computer. The entire process takes just 5 minutes.

## Prerequisites

Claude Code requires Node.js to run. Please ensure you have Node.js 18.0 or above installed on your computer (22 LTS recommended).

<div data-os="windows" markdown="1">

## Windows

### Step 1: Install Node.js

#### Option A: Official Download (Recommended)

1. Open your browser and visit [https://nodejs.org/](https://nodejs.org/)

2. Click the "LTS" version download (recommended Long Term Support version)

3. Double-click the downloaded `.msi` file

4. Follow the installation wizard using default settings

#### Option B: Using Package Manager

If you have Chocolatey or Scoop installed:

```powershell
# Using Chocolatey
choco install nodejs

# Or using Scoop
scoop install nodejs
```

#### Verify Installation

```powershell
node --version
npm --version
```

### Step 2: Install Claude Code

Open PowerShell or CMD:

```powershell
npm install -g @anthropic-ai/claude-code
```

Verify installation:

```powershell
claude --version
```

### Step 3: Set Environment Variables

#### Temporary (Current Session)

```powershell
$env:ANTHROPIC_BASE_URL = "https://api.qcode.cc/api"
$env:ANTHROPIC_AUTH_TOKEN = "your-api-key"
```

#### Permanent (Recommended)

```powershell
[System.Environment]::SetEnvironmentVariable("ANTHROPIC_BASE_URL", "https://api.qcode.cc/api", [System.EnvironmentVariableTarget]::User)
[System.Environment]::SetEnvironmentVariable("ANTHROPIC_AUTH_TOKEN", "your-api-key", [System.EnvironmentVariableTarget]::User)
```

> Replace `your-api-key` with your actual key from [QCode.cc Dashboard](https://qcode.cc/dashboard).

#### Verify the settings

```powershell
echo $env:ANTHROPIC_BASE_URL
echo $env:ANTHROPIC_AUTH_TOKEN
```

### Step 4: Start Using

```powershell
# Go to your project directory
cd C:\path\to\your\project

# Start Claude Code
claude
```

### Windows FAQ

**Permission error?**

- Run PowerShell as Administrator

- Or point npm at your user directory: `npm config set prefix %APPDATA%\npm`

**PowerShell execution policy error?**

```powershell
Set-ExecutionPolicy -ExecutionPolicy RemoteSigned -Scope CurrentUser
```

**Environment variables not taking effect?**

- After setting them permanently, restart PowerShell or CMD

- Or sign out of Windows and back in

</div>

<div data-os="macos" markdown="1">

## macOS

### Step 1: Install Node.js

#### Option A: Using Homebrew (Recommended)

```bash
brew update
brew install node
```

#### Option B: Official Download

1. Visit [https://nodejs.org/](https://nodejs.org/)

2. Download the macOS LTS version

3. Open the downloaded `.pkg` file

4. Follow the installation instructions

#### Verify Installation

```bash
node --version
npm --version
```

### Step 2: Install Claude Code

#### Option A: Using npm

```bash
npm install -g @anthropic-ai/claude-code
```

If you encounter permission issues:

```bash
sudo npm install -g @anthropic-ai/claude-code
```

#### Option B: Using Homebrew

```bash
brew install --cask claude-code
```

### Step 3: Set Environment Variables

#### Temporary (Current Session)

```bash
export ANTHROPIC_BASE_URL="https://api.qcode.cc/api"
export ANTHROPIC_AUTH_TOKEN="your-api-key"
```

#### Permanent (Recommended)

Edit your shell configuration file:

```bash
# For zsh (macOS default)
echo 'export ANTHROPIC_BASE_URL="https://api.qcode.cc/api"' >> ~/.zshrc
echo 'export ANTHROPIC_AUTH_TOKEN="your-api-key"' >> ~/.zshrc
source ~/.zshrc

# For bash
echo 'export ANTHROPIC_BASE_URL="https://api.qcode.cc/api"' >> ~/.bash_profile
echo 'export ANTHROPIC_AUTH_TOKEN="your-api-key"' >> ~/.bash_profile
source ~/.bash_profile
```

> Replace `your-api-key` with your actual key from [QCode.cc Dashboard](https://qcode.cc/dashboard).

### Step 4: Start Using

```bash
# Go to your project directory
cd /path/to/your/project

# Start Claude Code
claude
```

### macOS FAQ

**Permission error?**

- Install with sudo: `sudo npm install -g @anthropic-ai/claude-code`

- Or point npm at your user directory: `npm config set prefix ~/.npm-global`

**macOS blocks the binary?**

- Open "System Settings" → "Privacy & Security"

- Click "Open Anyway" or "Allow"

</div>

<div data-os="linux" markdown="1">

## Linux / WSL2

### Step 1: Install Node.js

#### Option A: Using NodeSource (Recommended)

```bash
# Add the NodeSource repository
curl -fsSL https://deb.nodesource.com/setup_lts.x | sudo -E bash -

# Install Node.js
sudo apt-get install -y nodejs
```

#### Option B: Using System Package Manager

```bash
# Ubuntu/Debian
sudo apt update
sudo apt install nodejs npm

# CentOS/RHEL/Fedora
sudo dnf install nodejs npm
```

#### Verify Installation

```bash
node --version
npm --version
```

### Step 2: Install Claude Code

```bash
npm install -g @anthropic-ai/claude-code
```

If you hit a permission problem:

```bash
sudo npm install -g @anthropic-ai/claude-code
```

Verify the installation:

```bash
claude --version
```

### Step 3: Set Environment Variables

#### Temporary

```bash
export ANTHROPIC_BASE_URL="https://api.qcode.cc/api"
export ANTHROPIC_AUTH_TOKEN="your-api-key"
```

#### Permanent

```bash
# For bash (default)
echo 'export ANTHROPIC_BASE_URL="https://api.qcode.cc/api"' >> ~/.bashrc
echo 'export ANTHROPIC_AUTH_TOKEN="your-api-key"' >> ~/.bashrc
source ~/.bashrc

# For zsh
echo 'export ANTHROPIC_BASE_URL="https://api.qcode.cc/api"' >> ~/.zshrc
echo 'export ANTHROPIC_AUTH_TOKEN="your-api-key"' >> ~/.zshrc
source ~/.zshrc
```

### Step 4: Start Using

```bash
cd /path/to/your/project
claude
```

### Linux FAQ

**Missing build dependencies?**

```bash
# Ubuntu/Debian
sudo apt install build-essential

# CentOS/RHEL
sudo dnf groupinstall "Development Tools"
```

</div>

## Advanced Configuration (Optional Environment Variables)

Beyond the two required variables, you can customize further with these optional variables:

### ANTHROPIC_MODEL

Specify the default model. We recommend setting Sonnet 5 explicitly. If unset, Claude Code uses its own built-in default for that CLI version — do not rely on a historical default name from this page. 4.x IDs such as `claude-sonnet-4-6` and `claude-opus-4-8` remain on sale.

```bash
# Daily recommendation (Sonnet 5)
export ANTHROPIC_MODEL=claude-sonnet-5

# Heavy work (Opus 5, higher cost)
export ANTHROPIC_MODEL=claude-opus-5
```

### MAX_THINKING_TOKENS

Control the maximum tokens for the model's thinking process (set to 0 to disable):

```bash
export MAX_THINKING_TOKENS=16000
```

### CLAUDE_CODE_EFFORT_LEVEL

Adjust Claude's effort level:

```bash
# Options: low / medium / high
export CLAUDE_CODE_EFFORT_LEVEL=high
```

### CLAUDE_CODE_DISABLE_NONESSENTIAL_TRAFFIC

Disable non-essential network requests (e.g., telemetry):

```bash
export CLAUDE_CODE_DISABLE_NONESSENTIAL_TRAFFIC=1
```

## Next Steps

Congratulations! You've successfully installed Claude Code. Next:

1. Check out [Quick Start](/docs/getting-started/quick-start) to learn basic usage

2. Explore [CLI Tips](/docs/usage/cli-tips) to boost efficiency