Skip to main content

Requirements

  • Node.js 18 or higher (node --version to check)
  • Supported platforms: macOS, Linux, Windows (including WSL)
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 below.

Install the package

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

Install locally in a project

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

Verify the installation

The command prints the installed version and exits.

Authentication

Claude Code supports several authentication methods. Configure one before your first session. Run claude from any directory. If no credentials are found, Claude Code launches an interactive OAuth flow:
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:

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:
Add the export to your shell profile (~/.bashrc, ~/.zshrc, etc.) to make it permanent.
If ANTHROPIC_API_KEY is set, Claude Code will not use an existing OAuth session. Clear the variable to switch back to OAuth.

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.):

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:

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:
You can also add this to your shell profile to make it permanent. To update manually when the auto-updater is disabled, run:

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:

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:

—use-system-ca

Pass --use-system-ca in NODE_OPTIONS to use the operating system’s CA store instead of the bundled Mozilla roots:
You can combine both options: --use-system-ca selects system CAs as the base, and NODE_EXTRA_CA_CERTS appends additional certificates on top.
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.

Configuration directory

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

Uninstall

Remove the global package with the package manager you used to install it:
You can also remove the configuration directory if you want to delete stored credentials and settings: