Skip to main content

Documentation Index

Fetch the complete documentation index at: https://mintlify.com/VineeTagarwal-code/claude-code/llms.txt

Use this file to discover all available pages before exploring further.

Prerequisites

Before installing Claude Code, make sure you have:
  • Node.js 18 or later — Required for the npm installation method. Check your version with node --version.
  • npm — Comes with Node.js. Check with npm --version.
  • An Anthropic account — Either a claude.ai subscription (Pro or Max) or an API key from console.anthropic.com.

Install via npm

The npm global install is the fastest way to get started and works on all platforms.
npm install -g @anthropic-ai/claude-code
This installs the claude command to your npm global bin directory. After installation, verify it works:
claude --version
If you see command not found: claude after installing, your npm global bin directory may not be on your PATH. Run npm bin -g to find the directory, then add it to your shell configuration file.

Other package managers

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

Native binary install

Claude Code also distributes a self-contained native binary for each platform. The native install places the binary at ~/.local/bin/claude (or %USERPROFILE%\.local\bin\claude.exe on Windows) and manages updates independently of npm. To install or switch to the native binary, run the claude install CLI command:
claude install
You can also specify a target version or channel:
claude install stable   # latest stable release
claude install latest   # latest pre-release
claude install 1.2.3    # specific version
The install command:
  1. Downloads the latest native binary for your platform and architecture
  2. Places it at ~/.local/bin/claude
  3. Sets up shell integration so the directory is on your PATH
  4. Removes old npm-based installations to avoid conflicts
The native installer places the binary at ~/.local/bin/claude and creates a symlink. Supported architectures: x64 and arm64 (Apple Silicon).After running claude install, add ~/.local/bin to your PATH if it is not already there:
echo 'export PATH="$HOME/.local/bin:$PATH"' >> ~/.zshrc
source ~/.zshrc

Authentication setup

Run claude after installing. On the first launch, Claude Code prompts you to authenticate.
claude
You will see an authentication menu with two options: If you have a claude.ai subscription (Pro or Max), choose this option. Claude Code opens an OAuth flow in your browser. After you approve the connection, Claude Code stores a token locally and you are signed in.

Option 2: Use an API key

If you use the Anthropic API directly, choose the API key option and paste your key when prompted. You can also set the key as an environment variable before launching:
export ANTHROPIC_API_KEY="sk-ant-..."
claude
Setting ANTHROPIC_API_KEY as an environment variable bypasses the authentication prompt on every launch. This is useful for CI environments and automated workflows.

Switching accounts

To sign in with a different account or switch authentication methods, run /login inside any session:
/login

Verify the installation

After installing and authenticating, confirm everything works:
claude --version
Then start a session and run /help to see available commands:
claude
> /help
You should see a list of all built-in slash commands. If you see the help output, Claude Code is installed and authenticated correctly.

Upgrading

Update to the latest version

Run the claude update command (alias: claude upgrade) to check for and install the latest release:
claude update
To install the native binary or a specific release channel, use claude install:
claude install stable   # latest stable release
claude install latest   # latest pre-release

Update via npm

If you installed via npm, update with your package manager:
npm update -g @anthropic-ai/claude-code

Automatic updates

Claude Code checks for updates in the background and installs them automatically when a new version is available. You can see the current auto-update settings with /config and toggle them there.

Uninstalling

npm uninstall -g @anthropic-ai/claude-code

Troubleshooting

command not found: claude after npm install Your npm global bin directory is not on your PATH. Run npm bin -g to find it, then add it to your shell’s config file (~/.zshrc, ~/.bashrc, or equivalent). Could not install — another process is currently installing Claude Another Claude Code process is already performing an install or update. Wait a moment and try again. If the error persists, use --force:
claude install --force
Authentication errors on startup Run /login inside a session to re-authenticate. If you are using an API key, check that ANTHROPIC_API_KEY is set correctly in your environment. Checking your installation status Use the /doctor command inside a session to run a diagnostic check:
/doctor
This reports your installation type, binary path, authentication status, and any configuration issues.