> ## Documentation Index
> Fetch the complete documentation index at: https://mintlify.com/jackdog668/claude-code/llms.txt
> Use this file to discover all available pages before exploring further.

# Installation

> Install Claude Code, configure authentication, and manage updates on macOS, Linux, and Windows.

## Requirements

* **Node.js 18 or higher** (`node --version` to check)
* **Supported platforms:** macOS, Linux, Windows (including WSL)

<Note>
  On Windows, running Claude Code natively via WSL (Windows Subsystem for Linux) is the recommended path. Ensure you use a Linux-native Node.js and npm installation inside WSL — not the Windows versions from `/mnt/c/`. See the [Windows note](#windows-and-wsl) below.
</Note>

## Install the package

Install `@anthropic-ai/claude-code` globally so the `claude` command is available anywhere on your system.

<CodeGroup>
  ```bash npm theme={null}
  npm install -g @anthropic-ai/claude-code
  ```

  ```bash yarn theme={null}
  yarn global add @anthropic-ai/claude-code
  ```

  ```bash pnpm theme={null}
  pnpm add -g @anthropic-ai/claude-code
  ```

  ```bash bun theme={null}
  bun add -g @anthropic-ai/claude-code
  ```
</CodeGroup>

### Install locally in a project

You can also install Claude Code as a local dev dependency and run it via `npx`:

```bash theme={null}
npm install --save-dev @anthropic-ai/claude-code
npx claude
```

## Verify the installation

```bash theme={null}
claude --version
```

The command prints the installed version and exits.

## Authentication

Claude Code supports several authentication methods. Configure one before your first session.

### 1. OAuth via claude.ai (recommended)

Run `claude` from any directory. If no credentials are found, Claude Code launches an interactive OAuth flow:

```bash theme={null}
claude
```

Follow the URL printed in your terminal to log in with your claude.ai account. Claude Code stores the resulting token locally. A Claude subscription is required for this flow.

To set up a long-lived token explicitly, run:

```bash theme={null}
claude setup-token
```

### 2. API key via environment variable

Set `ANTHROPIC_API_KEY` in your shell before running `claude`. Claude Code reads this variable at startup and skips the OAuth flow:

```bash theme={null}
export ANTHROPIC_API_KEY=sk-ant-...
claude
```

Add the export to your shell profile (`~/.bashrc`, `~/.zshrc`, etc.) to make it permanent.

<Warning>
  If `ANTHROPIC_API_KEY` is set, Claude Code will not use an existing OAuth session. Clear the variable to switch back to OAuth.
</Warning>

### 3. Amazon Bedrock

Set `CLAUDE_CODE_USE_BEDROCK=1` to route all API calls through Amazon Bedrock. Standard AWS credential resolution applies (environment variables, `~/.aws/credentials`, IAM instance roles, etc.):

```bash theme={null}
export CLAUDE_CODE_USE_BEDROCK=1
claude
```

### 4. Google Vertex AI

Set `CLAUDE_CODE_USE_VERTEX=1` to route all API calls through Google Vertex AI. Standard Google Cloud credential resolution applies:

```bash theme={null}
export CLAUDE_CODE_USE_VERTEX=1
claude
```

## Auto-updater

Claude Code checks for updates automatically and installs them in the background using `npm install -g` (or `bun install -g` when running under Bun). The updater requires write access to your global npm prefix directory.

### Disable the auto-updater

Set `DISABLE_AUTOUPDATER=1` in your environment to opt out of automatic updates:

```bash theme={null}
export DISABLE_AUTOUPDATER=1
```

You can also add this to your shell profile to make it permanent. To update manually when the auto-updater is disabled, run:

```bash theme={null}
claude update
```

### Windows and WSL

On Windows, the auto-updater requires a Linux-native npm installation. If Claude Code detects that npm is being resolved from the Windows path (e.g. `/mnt/c/...`), the update will fail. Install Node.js inside your Linux distribution and ensure the Linux `npm` appears first in `PATH`:

```bash theme={null}
# Example: install Node.js in Ubuntu/Debian WSL
sudo apt install nodejs npm
```

## System CA certificates

Claude Code uses the system's TLS stack for all API calls. In environments with custom or corporate CA certificates (e.g. TLS-intercepting proxies), you may need to supply additional certificates.

### NODE\_EXTRA\_CA\_CERTS

Point `NODE_EXTRA_CA_CERTS` to a PEM-format CA bundle file. Claude Code appends these certificates to the built-in Mozilla root store:

```bash theme={null}
export NODE_EXTRA_CA_CERTS=/path/to/corporate-ca-bundle.pem
```

### --use-system-ca

Pass `--use-system-ca` in `NODE_OPTIONS` to use the operating system's CA store instead of the bundled Mozilla roots:

```bash theme={null}
export NODE_OPTIONS="--use-system-ca"
```

You can combine both options: `--use-system-ca` selects system CAs as the base, and `NODE_EXTRA_CA_CERTS` appends additional certificates on top.

<Tip>
  If you see SSL certificate errors mentioning `*.anthropic.com`, set `NODE_EXTRA_CA_CERTS` to your corporate CA bundle path or ask your IT team to allowlist the Anthropic API endpoints.
</Tip>

## Configuration directory

Claude Code stores its configuration, session data, and credentials in `~/.claude/` by default. Override this with the `CLAUDE_CONFIG_DIR` environment variable:

```bash theme={null}
export CLAUDE_CONFIG_DIR=/custom/path/.claude
```

## Uninstall

Remove the global package with the package manager you used to install it:

<CodeGroup>
  ```bash npm theme={null}
  npm uninstall -g @anthropic-ai/claude-code
  ```

  ```bash yarn theme={null}
  yarn global remove @anthropic-ai/claude-code
  ```

  ```bash pnpm theme={null}
  pnpm remove -g @anthropic-ai/claude-code
  ```

  ```bash bun theme={null}
  bun remove -g @anthropic-ai/claude-code
  ```
</CodeGroup>

You can also remove the configuration directory if you want to delete stored credentials and settings:

```bash theme={null}
rm -rf ~/.claude
```
