HomeClaude Code › Install
OverviewInstallCLI referencePricing & limitsAgent SDKSkills & pluginsGitHubWeb, desktop & IDEModelsErrorsOpen source?TutorialFor studentsQA automation中文指南
Last updated: September 22, 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.

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 (no Node.js)

# macOS / Linux / WSL
curl -fsSL https://claude.ai/install.sh | bash
# Windows PowerShell
irm https://claude.ai/install.ps1 | iex

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.

Updating and uninstalling

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

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.69× 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 Code for studentsHow to use Claude Code for QA automationClaude Code 怎么用:从安装到日常使用