Requirements
- Node.js 18 or higher — Claude Code checks the Node.js version at startup and exits with an error if the requirement is not met.
- npm — used to install the package. Yarn and pnpm also work.
Claude Code uses Bun as its internal runtime and bundler. Bun is bundled into the distributed npm package — you do not need to install Bun separately.
Install
Platform notes
- macOS
- Windows
- Linux
Claude Code integrates with the macOS Keychain to store OAuth tokens and API keys securely. On first authentication, macOS will prompt you to allow Keychain access.The startup sequence prefetches Keychain reads in parallel to minimize latency (
keychainPrefetch.ts). If you use an MDM-managed device, Claude Code also reads MDM policy settings at startup via plutil.Apple Terminal backup/restore is supported — Claude Code saves and restores terminal state on session start and end.Environment variables
These environment variables configure Claude Code’s behavior. Set them in your shell profile or pass them inline before theclaude command.
| Variable | Description |
|---|---|
ANTHROPIC_API_KEY | Primary authentication method. Set this to your Anthropic API key to bypass the OAuth flow. |
ANTHROPIC_BASE_URL | Override the default Anthropic API endpoint. Use this to point at a proxy, a custom gateway, or a compatible alternative API. |
CLAUDE_CODE_MAX_OUTPUT_TOKENS | Override the maximum output tokens per model response. Useful for tasks that require longer completions than the default limit. |
DISABLE_INTERLEAVED_THINKING | Set to 1 to disable extended (interleaved) thinking. Extended thinking allows Claude to reason through complex problems before responding. |
Verify installation
Confirm the binary is available and check the installed version:/doctor command checks your Node.js version, authentication status, API connectivity, and reports any configuration issues.
Upgrade
To upgrade to the latest version:isAutoUpdaterDisabled configuration setting.
Uninstall
To remove Claude Code:claude binary from your PATH. Configuration files and session history stored in your home directory are not removed automatically.