How to Install Claude Code on Windows, macOS, and Linux
How do you install Claude Code?
Claude Code installs with one command: curl -fsSL https://claude.ai/install.sh | bash on macOS, Linux, and WSL, or irm https://claude.ai/install.ps1 | iex in Windows PowerShell. This method doesn't need Node.js. You need a Pro, Max, Ultra, Team, Enterprise, or Console account, or access through a cloud provider; the free claude.ai plan doesn't include Claude Code (Anthropic documentation, November 29, 2026).
TL;DR
- -The native installer is the recommended method: it doesn't need Node.js and updates itself. Homebrew, WinGet, apt, dnf, and apk installs are updated manually by default.
- -After installing, open a new terminal window and run claude --version. For detailed diagnostics without starting a session, run claude doctor.
- -If the terminal can't find claude, add ~/.local/bin (on Windows %USERPROFILE%\.local\bin) to PATH. The installer doesn't change PATH itself.
- -WSL is optional on Windows: the native install suits Windows projects, WSL 2 is for Linux tools and sandboxing. WSL 1 and native Windows have no sandbox.
- -The ANTHROPIC_API_KEY variable can override your subscription: after you confirm it in interactive mode, always in -p mode. /status shows the active sign-in method.
Claude Code installs with one command and doesn’t need Node.js. Which command depends on your system and shell.
macOS, Linux, WSL (in WSL, run it inside the distribution):
curl -fsSL https://claude.ai/install.sh | bash
Windows PowerShell (the prompt starts with PS C:\):
irm https://claude.ai/install.ps1 | iex
Windows CMD (the prompt is C:\ without PS):
curl -fsSL https://claude.ai/install.cmd -o install.cmd && install.cmd && del install.cmd
The installer shows no download progress. When it finishes, open a new terminal window and check the result with claude --version: it prints a number like 2.1.211 (Claude Code). Then run claude in your project directory and sign in through the browser.
This guide covers installing Claude Code, signing in, and fixing common errors. Commands and requirements were checked against Anthropic’s documentation on November 29, 2026. The author works on macOS and tested the claude doctor diagnostics there. The macOS install itself and everything about Windows, WSL, and Linux follow the documentation.
What you need before installing Claude Code
| Requirement | Value per documentation |
|---|---|
| macOS | 13.0 or later |
| Windows | 10 version 1809 or later, Server 2019 or later, 64-bit only |
| Linux | Ubuntu 20.04+, Debian 10+, Alpine 3.19+ |
| Hardware | 4 GB RAM or more, x64 or ARM64 processor |
| Shell | Bash, Zsh, PowerShell, or CMD |
| Network | internet access, including downloads.claude.ai |
| Account | Pro, Max, Ultra, Team, Enterprise, Console, or a cloud provider |
| Country | on the supported list |
Git is optional. You can skip the terminal too: there’s a Desktop app and extensions for VS Code and JetBrains. The sections below are about the CLI only.
Installation methods by operating system
Anthropic marks the native installer as recommended. The other methods make sense if a package manager already maintains the software on your system.
| Method | Command | Updates |
|---|---|---|
| Native | commands at the top of this page | automatic, in the background |
| Homebrew (macOS), stable channel | brew install --cask claude-code | brew upgrade claude-code |
| Homebrew (macOS), latest channel | brew install --cask claude-code@latest | brew upgrade claude-code@latest |
| WinGet | winget install Anthropic.ClaudeCode | winget upgrade Anthropic.ClaudeCode |
| apt (Debian, Ubuntu) | repository and key, then sudo apt install claude-code | sudo apt update && sudo apt upgrade claude-code |
| dnf (Fedora, RHEL) | repository file, then sudo dnf install claude-code | sudo dnf upgrade claude-code |
| apk (Alpine) | key and repository, then apk add bash claude-code | apk update && apk upgrade claude-code |
Repository setup and the signing key fingerprint are in Install with Linux package managers. On Alpine, the curl command needs apk add bash curl first, otherwise it ends with a not found error.
What install.sh does
Piping someone else’s script into | bash is worth a check first. According to the text of install.sh on November 29, 2026, it detects the platform, gets the latest version number and the manifest from downloads.claude.ai, downloads the binary, and verifies its SHA256 against the manifest. Then it runs claude install, which sets up the launcher and shell integration.
Under sudo from a regular user account, the script stops with Error: do not run this installer with sudo. Installing into your home directory doesn’t need root.
Verify the install: claude —version and claude doctor
claude --version answers one question: did the shell find the program? claude doctor prints install and settings diagnostics. It doesn’t start a session and changes nothing.
On the author’s machine (macOS, November 29, 2026, version 2.1.322), claude doctor showed:
- the install method (npm-global) and path;
- auto-update status: turned off by the
DISABLE_AUTOUPDATERvariable; - the channel and the last update attempt;
- the warning
Multiple installations found: npm-global and native at the same path.
The latest version on npm that day was 2.1.332. One command revealed two things that are hard to notice in daily work: updates are off, and two installations are registered. Remove the extra one when moving from npm.
Don’t confuse it with /doctor. That’s a command inside a session, and it can apply fixes itself after you confirm.
Claude Code on Windows: native or WSL 2
Per the documentation, Claude Code runs on Windows directly and inside WSL:
| Option | What you need | Sandbox | When to choose it |
|---|---|---|---|
| Native Windows | nothing, Git for Windows optional | no | Windows projects and tools |
| WSL 2 | WSL 2 enabled | yes | Linux tools or sandboxed commands |
| WSL 1 | WSL 1 enabled | no | WSL 2 is unavailable |
Choose by where the project lives and what builds it. A project built in Visual Studio fits native Windows; one with bash scripts and a Linux toolchain fits WSL 2. On native Windows, the agent’s commands run without a sandbox, which is another argument for WSL 2.
For WSL, run the Linux command inside the distribution, not from PowerShell or CMD, and start claude there too.
On the native option, Git for Windows provides Git Bash, which the Bash tool uses. Without it, Claude Code uses PowerShell. If Git is in a non-standard location, set the path in settings.json:
{
"env": {
"CLAUDE_CODE_GIT_BASH_PATH": "C:\\Program Files\\Git\\bin\\bash.exe"
}
}
Only a file named bash.exe, sh.exe, bash, or sh works. Claude Code ignores the git-bash.exe launcher.
First sign-in and the ANTHROPIC_API_KEY trap
On first launch, claude opens a browser. If it didn’t, press c: the sign-in URL is copied to the clipboard. If the browser shows a code, paste it into the terminal at Paste code here if prompted. A successful sign-in ends with Login successful.
In WSL 2, over SSH, and in containers, the browser often doesn’t open, or gets stuck on localhost after sign-in. The steps are the same: open the copied URL in a browser on your own machine and paste the code. If pasting into the prompt does nothing, use claude auth login, which reads the code from standard input.
Check the ANTHROPIC_API_KEY variable separately. According to the documentation, its key ranks above a subscription sign-in. In interactive mode, Claude Code asks for permission once and remembers the answer; in -p mode it uses the key without asking. That work is billed through the API even when your subscription is active. To see what the session uses, run /status.
Claude Code install errors: message, cause, fix
The tables hold 15 rows of typical messages. The selection is editorial; the texts and fixes come from Troubleshoot installation and login (November 29, 2026). The official table has 49 rows, so look up any other case there by its error text.
PATH and the wrong command
| Error | Cause | Fix |
|---|---|---|
command not found: claude, 'claude' is not recognized as an internal or external command, The term 'claude' is not recognized | install directory not in PATH | add the directory to PATH, open a new window |
zsh: permission denied: /Users/you/.zshrc (in Bash, the same for .bashrc) | no write access to the shell file, so the PATH line wasn’t saved | another user owns it: sudo chown $(whoami) ~/.zshrc; you own it: chmod u+w ~/.zshrc; repeat |
The token '&&' is not a valid statement separator | CMD command run in PowerShell | irm https://claude.ai/install.ps1 | iex |
'irm' is not recognized as an internal or external command | PowerShell command run in CMD | open PowerShell or use the install.cmd command |
A parameter cannot be found that matches parameter name 'fsSL', 'bash' is not recognized as the name of a cmdlet | macOS and Linux command run in Windows PowerShell | irm https://claude.ai/install.ps1 | iex |
Download, network, and memory
| Error | Cause | Fix |
|---|---|---|
syntax error near unexpected token `<', < was unexpected at this time., System.Xml.XmlDocument, curl: (22) The requested URL returned error: 403 | a web page, XML, or an error code came back instead of the script | retry in a few minutes; use Homebrew or WinGet; on 403 check the proxy; if the text contains App unavailable in region, the country isn’t supported |
curl: (35) TLS connect error, Could not create SSL/TLS secure channel | the TLS handshake failed | Ubuntu and Debian: update ca-certificates; PowerShell 5.1: enable TLS 1.2; check the proxy |
unable to get local issuer certificate, SELF_SIGNED_CERT_IN_CHAIN | a corporate proxy replaces the certificate | macOS and Linux: point CURL_CA_BUNDLE and NODE_EXTRA_CA_CERTS at your company’s PEM file; Windows: add the certificate to the store |
Killed, Installation was killed before it could finish (exit code 137) | not enough memory on Linux, the install needs about 512 MB free | close processes, add swap, or use a larger machine |
Windows and WSL
| Error | Cause | Fix |
|---|---|---|
running scripts is disabled on this system | PowerShell policy blocks npm’s .ps1 launchers | switch to the PowerShell installer, call claude.cmd, or run Set-ExecutionPolicy -ExecutionPolicy RemoteSigned -Scope CurrentUser |
Claude Code on Windows requires either Git for Windows (for bash) or PowerShell | neither Git Bash nor PowerShell was found | add C:\Windows\System32\WindowsPowerShell\v1.0\ to PATH, install PowerShell 7 or Git for Windows |
cannot execute binary file: Exec format error in WSL | WSL 1 can’t load the binary | wsl --set-version <DistroName> 2 from PowerShell |
npm and sign-in
| Error | Cause | Fix |
|---|---|---|
Error: claude native binary not installed. | npm skipped postinstall (npm 12 does this by default) or the optional dependency | install with the native installer and remove the npm package |
OAuth error: Invalid code, That doesn't look like the full code | the sign-in code expired or was copied only in part | press Enter to retry; copy the whole code, including the # |
API Error: 400 ... "This organization has been disabled" with an active subscription | an old ANTHROPIC_API_KEY overrides the subscription | unset ANTHROPIC_API_KEY (PowerShell: Remove-Item Env:ANTHROPIC_API_KEY), remove the line from your shell profile |
Two limits can’t be bypassed, per the documentation. A processor without AVX (roughly pre-2013) or a virtual machine that doesn’t pass AVX through gives Illegal instruction, and there’s no native-binary workaround. macOS older than 13.0 gives a dyld error, and Homebrew won’t help because the binary is the same. The documentation points to issues #50384 (AVX) and #38788 (the WSL 1 error from the table). Both were auto-closed for inactivity, in May and July 2026, as not planned, so don’t expect news of a fix there.
PATH step by step
The installer puts the program in ~/.local/bin/claude on macOS and Linux and in %USERPROFILE%\.local\bin\claude.exe on Windows. If the directory isn’t in PATH, it says so in the Setup notes: block but doesn’t change PATH.
First make sure the file is there, then add the directory. For Zsh, the default shell on macOS:
ls -la ~/.local/bin/claude
echo 'export PATH="$HOME/.local/bin:$PATH"' >> ~/.zshrc
source ~/.zshrc
In Bash on Linux, use ~/.bashrc instead of ~/.zshrc; in Bash on macOS, ~/.bash_profile. Fish and Nushell need their own syntax.
In Windows PowerShell, the first line should print True:
Test-Path "$env:USERPROFILE\.local\bin\claude.exe"
$currentPath = [Environment]::GetEnvironmentVariable('PATH', 'User')
[Environment]::SetEnvironmentVariable('PATH', "$currentPath;$env:USERPROFILE\.local\bin", 'User')
From CMD, add the same directory through System Settings → Environment Variables. Then restart the terminal, and the editor too if the terminal is built into it.
The VS Code extension puts nothing in this directory: it has its own copy of the CLI inside the extension. If that’s all you have, there’s no claude command in the terminal.
Updates and the latest and stable channels
A native install checks for updates at startup and while running; the new version takes effect on the next start. To update manually, run claude update.
There are two channels. latest (the default) gets releases right away. stable is about a week behind and skips versions with major regressions. On November 29, 2026, the npm latest tag pointed to 2.1.332 from November 24 and stable to 2.1.326 from November 16. Change the channel in /config or in settings.json:
{
"autoUpdatesChannel": "stable",
"minimumVersion": "2.1.323"
}
minimumVersion prevents a downgrade below the given version when you switch to stable. Put your own number from claude --version there. The downside of stable: a new model may require a newer Claude Code.
Setting "DISABLE_AUTOUPDATER": "1" in the env block turns off background updates; claude update still works. DISABLE_UPDATES blocks every update path.
Moving from npm to the native install
The npm package is still available, but the repository README marks npm installation as deprecated, and the documentation recommends native. The binary is the same either way. The Node.js 18+ badge in the README is out of date: the documentation and the npm registry require Node.js 22 or later.
Steps for macOS, Linux, and WSL:
curl -fsSL https://claude.ai/install.sh | bash
npm uninstall -g @anthropic-ai/claude-code
which -a claude # every claude found
ls -la ~/.local/bin/claude # symlink into ~/.local/share/claude/versions/
ls -la ~/.claude/local/ # old local npm install
If several installations remain, the documentation advises keeping only the native one. Earlier versions created the ~/.claude/local directory; delete it separately. When claude doctor shows npm and native at the same path, as on the author’s machine, check after npm uninstall that ~/.local/bin/claude is still there. If it’s gone, run the installer again.
The documentation doesn’t directly promise that settings and history survive a change of install method. Removing the npm package and deleting ~/.claude are described as separate steps, but back up ~/.claude and ~/.claude.json before you switch.
If you stay on npm, don’t install the package with sudo: self-update runs npm without it and will fail. Update with npm install -g @anthropic-ai/claude-code@latest, not npm update -g.
How to uninstall Claude Code
| Install method | Uninstall command |
|---|---|
| Native, macOS, Linux, WSL | rm -f ~/.local/bin/claude and rm -rf ~/.local/share/claude |
| Native, Windows | Remove-Item for $env:USERPROFILE\.local\bin\claude.exe and $env:USERPROFILE\.local\share\claude (with -Recurse -Force) |
| Homebrew | brew uninstall --cask claude-code |
| WinGet | winget uninstall Anthropic.ClaudeCode |
| npm | npm uninstall -g @anthropic-ai/claude-code |
| apt, dnf, apk | package, repository file, and key, commands in the docs |
User data is separate, in ~/.claude and ~/.claude.json. Deleting it erases settings, permissions, MCP configuration, and session history. If claude still runs after you uninstall it, a second installation or an alias remains: look for it with which -a claude or where.exe claude.
Next steps
- Run
claude doctorand clear its warnings before you start configuring. - Check
/status: you should be signed in with the method you intend to pay for. - Describe the project in CLAUDE.md and move mandatory checks into hooks.
- Permissions, skills, subagents, and CI runs are covered in the complete Claude Code guide.
- Before connecting external systems, see how MCP differs from an API.
Sources
All pages were opened on November 29, 2026.