Home › Claude Code › Install
OverviewInstallCLI referencePricing & limitsAgent SDKSkills & pluginsGitHubWeb, desktop & IDEModelsErrorsOpen source?TutorialFor studentsQA automationvs Cursorvs Codex & OpenCodeSubagentsHooksMCPEcosystemVS CodeOpenRouterRate limits中文指南
Last updated: November 06, 2026

How to install Claude Code

There are three supported ways to get Claude Code onto a machine. Pick one; they all produce the same claude command.

TLDR

  • npm: npm install -g @anthropic-ai/claude-code (needs Node.js 18+).
  • Native installer: one curl (macOS/Linux) or one PowerShell line (Windows) — no Node required.
  • Verify with claude --version, then set ANTHROPIC_BASE_URL and ANTHROPIC_API_KEY to use this gateway.

Node.js for Claude Code: which version, and how to skip it

The npm route needs Node.js 18 or newer — node -v to check; nvm (nvm install --lts) to fix. Older Node is the most common reason a fresh install will not start. If Node is not part of your toolchain, skip it: the native installer below ships a standalone binary and updates itself.

Option 1 — npm (any OS with Node.js 18+)

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

If npm install -g fails with EACCES on macOS or Linux, do not use sudo — fix the npm prefix instead: npm config set prefix ~/.npm-global and add ~/.npm-global/bin to your PATH. On Windows, run the install from a normal (non-admin) terminal.

Option 2 — native installer for Mac, Linux and Windows (no Node.js)

# macOS / Linux / WSL
curl -fsSL https://claude.ai/install.sh | bash
# Windows PowerShell
irm https://claude.ai/install.ps1 | iex
# Windows CMD (the one-liner people search for)
curl -fsSL https://claude.ai/install.cmd -o install.cmd && install.cmd && del install.cmd

Install Claude Code on Linux and Ubuntu

On Ubuntu, Debian, Fedora or any distro: the native installer (curl -fsSL https://claude.ai/install.sh | bash) drops a self-updating binary in your home directory and needs no root and no Node.js. If you prefer npm, install Node 18+ from NodeSource or nvm first — Ubuntu's apt Node is usually too old — then npm install -g @anthropic-ai/claude-code. In a terminal-only server or a container, the native binary is the better choice; add the two gateway variables to ~/.bashrc and it works over SSH exactly as it does locally.

The native build updates itself and avoids Node version conflicts. It is the better choice on machines where Node is not already part of your toolchain.

Option 3 — desktop app or IDE extension

The Claude desktop app bundles Claude Code, and the VS Code and JetBrains extensions install the CLI for you on first use. See the web, desktop and IDE guide for what each surface can and cannot do.

Windows notes

Claude Code runs natively on Windows 10/11 (PowerShell or Git Bash) and inside WSL. WSL is the smoother experience for projects that assume a Unix shell. If claude is not found after an npm install on Windows, open a new terminal so PATH is re-read, or check npm config get prefix and add its bin folder.

Run Claude Code without login: authenticate with an API key

Run claude and choose /login to sign in with a Claude Pro/Max subscription — or skip the login entirely. With ANTHROPIC_API_KEY (or ANTHROPIC_AUTH_TOKEN) set, Claude Code never shows the login screen and runs locally against whatever endpoint ANTHROPIC_BASE_URL names, which is also how it runs on machines that cannot open a browser. For this gateway, use the key route:

export ANTHROPIC_BASE_URL=https://aiprimetech.io
export ANTHROPIC_API_KEY=your_gateway_key   # or ANTHROPIC_AUTH_TOKEN
claude

Put those two lines in ~/.zshrc, ~/.bashrc or your PowerShell profile so every new terminal has them. Inside Claude Code, /status shows which endpoint and key are active.

How to update and uninstall Claude Code

claude update                      # native / self-update
npm update -g @anthropic-ai/claude-code   # npm install
npm uninstall -g @anthropic-ai/claude-code

If the install worked but Claude Code will not start

  • command not found → PATH: open a new shell, or add npm's global bin directory.
  • Node version errors → Node.js 18 or newer is required; node -v to check, or switch to the native installer.
  • Hangs on first launch → corporate proxy; set HTTPS_PROXY, or the gateway base URL if your network blocks api.anthropic.com.
  • 401 / invalid key → the key must be a gateway key when ANTHROPIC_BASE_URL points here; an Anthropic console key will be rejected.

Frequently asked questions

Do I need Node.js to install Claude Code?

Only for the npm route. The native installer (curl on macOS/Linux, PowerShell on Windows) and the desktop app do not need Node.

Does Claude Code run on Windows?

Yes, natively in PowerShell or Git Bash, and inside WSL. WSL is recommended for Unix-shaped projects.

Can I install Claude Code without a Claude subscription?

Yes. Install is free; authenticate with an API key instead of /login. A gateway key from this site works as a drop-in.

Run Claude Code on the gateway

Same models, two environment variables, credits at 7.69231× face value — or a flat-rate unlimited plan.

Get an API key See unlimited plans

AI Prime Tech is an independent API gateway and is not affiliated with, endorsed by, or sponsored by Anthropic. “Claude” and “Claude Code” are trademarks of Anthropic. Claude Code features described here follow Anthropic’s public documentation at the time of writing and change frequently; prices and model lists on this page are read from this gateway’s live settings.

More Claude Code guides

Claude Code: the complete guideClaude Code CLI documentation: commands and flagsClaude Code pricing and limits, explainedThe Claude Code SDK, now the Claude Agent SDKClaude Code skills and pluginsClaude Code in GitHub: the App, the Action and @claudeDoes Claude Code have a web interface? Web, desktop and IDE explainedWhich model Claude Code uses, and how to change itClaude Code errors and how to fix themIs Claude Code open source?Claude Code tutorial: your first real sessionClaude for students: Claude Code, the API and what education actually gets youHow to use Claude Code for QA automationClaude Code vs Cursor: which one, when — and how to run bothClaude Code vs Codex vs OpenCode: the terminal agents comparedClaude Code subagents: how they work, how to define them, and agent teamsClaude Code hooks: deterministic control over what the agent doesClaude Code MCP: connecting servers, scopes, remote MCP and real examplesThe Claude Code ecosystem: routers, frameworks, plugins and the lists that track themClaude Code in VS Code: the extension, the terminal route, and the errorsHow to use OpenRouter in Claude Code (and when not to)Claude rate limit error: what "API error: rate limit reached" means and how to fix itClaude Code 怎么用:从安装到日常使用