"The install walked me through a proxy issue I had been stuck on for an afternoon. The HTTPS_PROXY note was the missing piece — once I set that, claude code install finished without a hitch."— Oanh T. VuSoftware Engineer · Tidenwell Analytics · Hanoi
Install Claude Code
Everything you need to install Claude Code on Windows, macOS, or Linux — prerequisites, exact commands, and the environment variables worth setting before the first run.
Before you run this
The single most common install failure is a Node.js version below 18. Run node --version before anything else, and upgrade if the output reads 16 or lower — the error you will see otherwise is rarely descriptive enough to point back to Node directly.
What install claude code actually does
Installing Claude Code places a CLI binary on your PATH via the npm global package registry. There is no separate installer file to download, no GUI wizard to step through, and no system service to register. One npm command fetches the package, links the binary, and the shell can reach it immediately.
The package ships with the CLI itself, a default set of skill manifests, and the auth helper that handles the API key handshake. Every subsequent update also goes through npm update -g @anthropic-ai/claude-code, so the install mechanism doubles as the upgrade path. You do not need administrative rights on macOS or Linux if your Node.js global prefix is inside your home directory; on Windows you may need to run the terminal as Administrator depending on how Node was installed.
Prerequisites by operating system
All three platforms share the same core requirement: Node.js 18 or later. Beyond that, each OS has one or two platform-specific steps worth knowing before you start.
macOS — The default Terminal app works fine. If you manage packages with Homebrew, install Node via brew install node and skip the Node.js download entirely. Shell profiles on modern macOS default to ~/.zshrc; that is where the API key export line should live.
Windows — Two routes exist: the native PowerShell path and the WSL-based route. The native path is faster to set up; WSL avoids line-ending headaches for teams that use Linux in production. Both are covered in detail on the claude code windows page. For either route, install Node from the official installer and make sure the installer's option to add Node to PATH is checked.
Linux — Install Node via your distro's package manager (apt, dnf, or pacman) or via a version manager like nvm. The install command for Claude Code is identical regardless of distribution. If your corporate proxy intercepts HTTPS traffic, set HTTPS_PROXY before running npm.
Install command by platform
The table below shows the install command and its prerequisites for each supported operating system. The command is the same on macOS and Linux; the Windows entry shows the PowerShell variant.
| OS | Prerequisite | Install command |
|---|---|---|
| macOS (Terminal / zsh) | Node.js ≥ 18, npm ≥ 9 | npm install -g @anthropic-ai/claude-code |
| Windows (PowerShell) | Node.js ≥ 18 (official installer), npm ≥ 9 | npm install -g @anthropic-ai/claude-code |
| Windows (WSL / Ubuntu) | WSL2, Node.js ≥ 18 inside WSL | npm install -g @anthropic-ai/claude-code |
| Linux (Debian/Ubuntu) | Node.js ≥ 18 via apt or nvm | npm install -g @anthropic-ai/claude-code |
| Linux (Fedora/RHEL) | Node.js ≥ 18 via dnf or nvm | npm install -g @anthropic-ai/claude-code |
Running the install step by step
Follow these steps in order. Each one builds on the previous, and skipping step two is the most frequent reason people end up with a working binary that immediately fails on the first API call.
Step 1 — Check your Node version
Open a terminal and run the version check before anything else.
node --version
# expected: v18.x.x or higher
npm --version
# expected: 9.x.x or higher
If Node is below 18, upgrade now. On macOS with Homebrew: brew upgrade node. On Linux: use your package manager or switch to nvm use 20. On Windows: download the current LTS installer from the Node.js site and re-run it.
Step 2 — Run the npm install
With Node confirmed at 18 or above, run the global install.
npm install -g @anthropic-ai/claude-code
The command pulls the package from the npm registry, installs it globally, and links the binary. On a typical broadband connection it takes ten to thirty seconds. If npm reports a permissions error on macOS or Linux, the fix is usually to either use nvm (which puts the global prefix inside your home directory) or to take ownership of the npm prefix directory — never run npm with sudo.
Step 3 — Verify the binary
Confirm the CLI is on your PATH.
claude --version
If the shell reports "command not found", the npm global bin directory is not in PATH. On macOS with the system Node, add export PATH="$(npm prefix -g)/bin:$PATH" to your ~/.zshrc and run source ~/.zshrc.
Step 4 — Set the API key
Add the key export to your shell profile so it persists across sessions.
# macOS / Linux: add to ~/.zshrc or ~/.bash_profile
export ANTHROPIC_API_KEY="sk-ant-..."
# Reload the profile
source ~/.zshrc
On Windows PowerShell, add the variable to your profile script ($PROFILE) or set it as a system environment variable via the Control Panel. The CLI setup page covers the full list of optional variables.
Step 5 — Run the auth check
Confirm the key is accepted before opening a project.
claude auth
A successful auth check prints a confirmation line with the account email. If it fails with a 401, the key is either malformed or the export line was not reloaded. If it fails with a network error, check HTTPS_PROXY settings first.
Chinese-language documentation
For Chinese-language install and usage tutorials (claude code 安装), the claude code tutorials page includes a dedicated section with step-by-step content in Simplified Chinese.
Keeping Claude Code up to date
Claude Code releases follow the npm versioning cadence. To update to the latest version, run the same install command with the latest tag or use the update shorthand.
npm update -g @anthropic-ai/claude-code
# Or pin to a specific version
npm install -g @anthropic-ai/claude-code@1.5.0
Check the currently installed version at any time with claude --version. The Claude Code download page lists the current stable release and the version naming convention used across packages.
For context on the safety framing around AI developer tools, the NIST AI Risk Management Framework is a useful reference when evaluating deployment policies for your team.
Frequently asked questions about installing Claude Code
What is the minimum Node.js version needed to install Claude Code?
Claude Code requires Node.js 18 or later. Older Node versions may silently break the auth flow or produce cryptic module-loading errors. Run node --version before starting, and upgrade via your system package manager if the version is below 18. The CLI does not support Node 16 or the end-of-life Node 14 releases.
How do I install Claude Code on macOS?
Open Terminal and run npm install -g @anthropic-ai/claude-code. If you use Homebrew, install Node first with brew install node. After the install, verify with claude --version and add export ANTHROPIC_API_KEY="sk-ant-..." to your ~/.zshrc. Reload the profile with source ~/.zshrc, then run claude auth to confirm.
Can I install Claude Code on Linux?
Yes. Claude Code installs on any Linux distribution with Node.js 18 or later. Install Node via apt, dnf, or pacman, or use nvm for version management. Then run npm install -g @anthropic-ai/claude-code. The command is identical on Debian, Fedora, and Arch-based systems. If your environment requires a proxy, set HTTPS_PROXY first.
What environment variables does Claude Code need?
ANTHROPIC_API_KEY is the only required variable. Set it in your shell profile and reload. Optional variables include CLAUDE_MODEL to pin a model version and HTTPS_PROXY for corporate proxy environments. The full list with default values is on the CLI setup page.
What does the claude code install command actually do?
Running npm install -g @anthropic-ai/claude-code downloads the CLI package from the npm registry, places the binary in your Node.js global bin directory, and links it to your PATH. No separate binary download or GUI step is needed. The package includes the CLI, default skill manifests, and the auth helper that validates your API key.
Related topics
After completing the install claude code steps, most engineers move to one of the platform-specific pages for environment tuning: claude code windows for PowerShell and WSL setup, or claude code desktop if you prefer the windowed client over the terminal. The CLI setup page covers PATH configuration and every supported environment variable in detail, and the claude code download reference explains version naming and how to verify the package before installing.
Once the CLI is running, the claude code skills walkthrough is worth reading next — skills extend what the CLI can do without any additional install step. For model selection, the models overview and claude opus pages sit side by side with the claude api reference. Teams evaluating cost should check the free tier notes, and the claude ai download page covers the desktop client artefacts if you want the GUI alongside the CLI. The claude code tutorials page serves as the entry point for Chinese-language documentation.
Ready to run your first command?
Follow the CLI setup guide to configure your shell profile, set environment variables, and confirm the auth flow before opening a project.
Go to CLI setup