Guides

Install Claude Code: Every Official Method

Install Claude Code with the native installer, Homebrew, WinGet, apt, dnf, apk or npm. OS limits, WSL notes, sign-in, updates, uninstall and error fixes.

The fastest way to install Claude Code is the native installer: curl -fsSL https://claude.ai/install.sh | bash on macOS, Linux and WSL, or irm https://claude.ai/install.ps1 | iex in Windows PowerShell. Then open a new terminal, run claude --version, and run claude to sign in. Homebrew, WinGet, apt, dnf, apk and npm are also official. We checked Anthropic's docs on 31 October 2026.

This page is about getting the tool onto your machine and keeping it healthy. Once it runs, the how to use Claude Code guide takes over with the first session, prompts and permissions. We do not repeat that material here.

The install methods at a glance

Anthropic documents six routes. They all end with the same claude command. What changes is who updates it, who can remove it cleanly, and how much of your machine it touches.

Method

Platforms

Updates itself

Needs

Pick it when

Native installer

macOS, Linux, WSL, Windows

Yes, in the background

curl or PowerShell

You want the default and no upkeep

Homebrew

macOS, Linux

No

Homebrew

You already manage tools with brew

WinGet

Windows

No

WinGet

You manage Windows tools with winget

apt, dnf, apk

Debian and Ubuntu, Fedora and RHEL, Alpine

No

Root access

You deploy to servers and want signed system packages

npm

Any supported platform

Through npm

Node.js 22 or later

You already have an npm toolchain, or a locked-down image

Desktop app

macOS, Windows, Linux

See the Desktop docs

A download

You would rather skip the terminal

The docs call the native installer the recommended route, and it is the only one that updates in the background without extra settings. If you have no strong reason to pick another, use it.

System requirements

The setup page lists what Claude Code runs on. Check these before you blame the installer.

Item

Requirement

macOS

13.0 or later

Windows

Windows 10 version 1809 or later, or Windows Server 2019 or later

Linux

Ubuntu 20.04+, Debian 10+, Alpine Linux 3.19+

Hardware

4 GB or more of RAM, x64 or ARM64 processor

Network

An internet connection

Shell

Bash, Zsh, PowerShell or CMD

Location

A country on Anthropic's supported list

Two more details matter. The installer itself needs roughly 512 MB of free memory, which is why small VPS instances sometimes fail mid-install. And Claude Code ships with ripgrep, so you normally add nothing, except on Alpine, covered below.

If a download returns "App unavailable in region", the docs say Claude Code is not available in your country. No setting fixes that.

Install with the native installer

Pick the command for your shell. The setup page prints all three.

curl -fsSL https://claude.ai/install.sh | bash

That one is for macOS, Linux and WSL.

irm https://claude.ai/install.ps1 | iex

That one is for Windows PowerShell, where the prompt starts with PS C:\.

curl -fsSL https://claude.ai/install.cmd -o install.cmd && install.cmd && del install.cmd

And that one is for Windows CMD, where the prompt has no PS.

The installer prints no progress while it downloads, so a quiet terminal does not mean it hung. When it finishes, open a new terminal window. A window that was already open keeps its old PATH and will not see the new command.

The installer puts the launcher at ~/.local/bin/claude on macOS and Linux, and at %USERPROFILE%\.local\bin\claude.exe on Windows. It does not edit your PATH. If the folder is missing from PATH, the installer says so under "Setup notes" and prints the fix.

Choose a channel or a version

The native installer takes an argument. Pass stable for the release channel that runs about a week behind and skips releases with major regressions, or pass a version number.

curl -fsSL https://claude.ai/install.sh | bash -s stable
curl -fsSL https://claude.ai/install.sh | bash -s 2.1.89

On PowerShell the pattern wraps the script in a scriptblock:

& ([scriptblock]::Create((irm https://claude.ai/install.ps1))) stable

The channel you pick at install time becomes your default for auto-updates. The docs also describe an autoUpdatesChannel setting, which accepts "latest" (the default) or "stable", and a minimumVersion setting that stops background updates from installing anything below a floor you set.

One catch from the docs: a newly launched model can need a Claude Code version newer than the stable channel serves. If a model you want is missing, move to the latest channel.

Install with Homebrew

brew install --cask claude-code

Homebrew offers two casks. claude-code follows the stable channel, usually about a week behind. claude-code@latest receives versions as soon as they ship. Pick one and stay on it, because upgrading the wrong name gives the error Cask 'claude-code@latest' is not installed.

Homebrew installs do not update themselves. Run brew upgrade claude-code, or brew upgrade claude-code@latest if that is the cask you chose. Homebrew also keeps old versions on disk, so the docs suggest an occasional brew cleanup.

If you want Claude Code to run the upgrade for you, set the CLAUDE_CODE_PACKAGE_MANAGER_AUTO_UPDATE environment variable to 1. It then upgrades only the Claude Code package, in the background, and shows a restart prompt on success.

Install with WinGet

winget install Anthropic.ClaudeCode

WinGet does not auto-update either. Run winget upgrade Anthropic.ClaudeCode now and then. The same CLAUDE_CODE_PACKAGE_MANAGER_AUTO_UPDATE switch works here, with one wrinkle: Windows locks a running executable, so the upgrade may fail while Claude Code is open, and the docs say Claude Code then shows you the manual command.

Install with apt, dnf or apk

Anthropic publishes signed repositories for Debian and Ubuntu, Fedora and RHEL, and Alpine. Each has a stable and a latest channel, and the commands on the setup page configure stable. These installs never update through Claude Code. Updates arrive through your normal system upgrade routine.

For apt, the flow is: download the signing key to /etc/apt/keyrings/claude-code.asc, confirm its fingerprint, add a deb line pointing at https://downloads.claude.ai/claude-code/apt/stable, then install.

sudo apt update
sudo apt install claude-code

The docs give the fingerprint to compare: 31DDDE24DDFAB679F42D7BD2BAA929FF1A7ECACE. Do not skip that step. A missing key later shows up as NO_PUBKEY BAA929FF1A7ECACE on apt update, which is the sign the key download failed.

The dnf route writes a repo file to /etc/yum.repos.d/claude-code.repo with gpgcheck=1, then runs sudo dnf install claude-code. dnf asks you to confirm the same key fingerprint on first install. The apk route downloads a .rsa.pub key into /etc/apk/keys/, appends the repository to /etc/apk/repositories, and runs apk add claude-code.

Upgrades use sudo apt update && sudo apt upgrade claude-code, sudo dnf upgrade claude-code and apk update && apk upgrade claude-code.

Install with npm

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

The npm package needs Node.js 22 or later. On an older Node, npm prints an EBADENGINE warning but the install still completes, because the package pulls a native binary through a per-platform optional dependency, such as @anthropic-ai/claude-code-darwin-arm64. The installed binary does not invoke Node. It is the same binary the standalone installer ships.

Three rules from the docs:

  • Never use sudo npm install -g. It causes permission problems, and Claude Code runs npm without sudo when it updates itself, so an install that needed sudo cannot update.
  • Upgrade with npm install -g @anthropic-ai/claude-code@latest. Avoid npm update -g, which respects the range from your first install and may not reach the newest release.
  • Your package manager must allow optional dependencies and postinstall scripts. If either is skipped, claude prints Error: claude native binary not installed. and the fix is to rerun without --ignore-scripts or --omit=optional.

If npm --version starts with 12, the docs send you to a separate "Fix an npm 12 install" section of the troubleshooting page rather than the steps above.

Windows, WSL and Alpine notes

Windows has two supported paths, and the setup page compares them.

Option

Needs

Sandboxing

Use it for

Native Windows

Nothing; Git for Windows is optional

Not supported

Windows-native projects and tools

WSL 2

WSL 2 enabled

Supported

Linux toolchains, or sandboxed command execution

WSL 1

WSL 1 enabled

Not supported

Only when WSL 2 is not available

You do not need an Administrator shell for the native Windows install. Git for Windows is optional but useful: it gives Claude Code Git Bash for its Bash tool. Without it, Claude Code runs shell commands through PowerShell. If it cannot find Git Bash, the docs show a CLAUDE_CODE_GIT_BASH_PATH entry for settings.json.

For WSL, open your Linux distribution and run the Linux installer there. Install and launch claude inside the WSL terminal, not from PowerShell or CMD. If you installed with npm inside WSL, watch for Windows tools leaking in. Paths starting with /mnt/c/ from which npm or which node mean WSL is using Windows binaries. The docs say to install Node through your distribution's package manager or nvm, and not to switch off Windows PATH importing, since that breaks calling Windows programs from WSL.

WSL 1 has a known problem. The docs list an Exec format error on WSL 1, tied to a native-binary regression, and the clean fix is converting the distribution to WSL 2 from PowerShell.

Alpine and other musl-based distributions need extra packages. The install command needs bash and curl, and at runtime Claude Code needs libgcc, libstdc++ and ripgrep. Install them, then set USE_BUILTIN_RIPGREP to 0 in settings.json.

apk add bash curl libgcc libstdc++ ripgrep

Sign in and pick an account type

After the install, run claude in your project folder. On first launch it opens a browser window for login. Claude Code needs one of these:

  • A Claude Pro, Max or Ultra subscription, using your claude.ai login.
  • Claude for Teams or Enterprise, using the account your admin invited.
  • A Claude Console account, with or without an API key.
  • A cloud provider: Amazon Bedrock, Google Cloud's Agent Platform or Microsoft Foundry. Set the provider variables first, or choose "3rd-party platform" at the login prompt.
  • A self-hosted Claude apps gateway, where you sign in with corporate SSO through /login.

The free claude.ai plan does not include Claude Code. See our Claude Code pricing page for what each plan costs, and the Claude API pricing page if you plan to use a Console account.

Some things worth knowing about login:

  • If ANTHROPIC_API_KEY is set and you approve the key when asked, Claude Code skips the login prompt and bills that account.
  • If the browser does not open, press c to copy the login URL, then paste it into a browser by hand.
  • If the browser shows a code instead of returning to the terminal, paste it at the Paste code here if prompted prompt.
  • claude auth login signs in from the shell before your first session. /login and /logout work inside a session.
  • To stay signed in to two accounts, give each a separate directory with CLAUDE_CONFIG_DIR, for example in an alias.

On WSL 2, over SSH and in containers, the browser flow can fail. The docs describe a fallback: copy the login URL, open it on your own machine, and paste the code it shows back into the terminal. On WSL 2 you can also set BROWSER to the path of your Windows browser.

Verify the install

Start with the version.

claude --version

A healthy install prints a number such as 2.1.211 (Claude Code). For more detail, run the doctor.

claude doctor

claude doctor is read-only. It does not start a session. It reports install health, settings-file validation errors and warnings with suggested fixes. It also shows the result of the last update attempt, and the Auto-updates line, which reads disabled (set by env: DISABLE_AUTOUPDATER) when you turned updates off.

Inside a session there is a second tool, /doctor. The skills docs describe it as a setup checkup that can find duplicate installs, PATH problems and unparseable settings, and it asks before changing anything. Our Claude Skills guide covers how skills such as /doctor are built and loaded.

Update Claude Code

How you update depends on how you installed.

Install method

How it updates

Manual command

Native

Automatically, in the background

claude update

Homebrew

Manual, or opt in to auto

brew upgrade claude-code

WinGet

Manual, or opt in to auto

winget upgrade Anthropic.ClaudeCode

apt

Manual

sudo apt update && sudo apt upgrade claude-code

dnf

Manual

sudo dnf upgrade claude-code

apk

Manual

apk update && apk upgrade claude-code

npm

Manual

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

Native installs check for updates on startup and while running. A new version downloads in the background and takes effect the next time you start Claude Code. claude update skips the wait.

To switch auto-updates off, set DISABLE_AUTOUPDATER to "1" in the env block of settings.json. That only stops the background check. claude update and claude install still work. To block every update path, including manual ones, set DISABLE_UPDATES instead. The docs suggest that for teams that distribute Claude Code themselves.

If you replace the native launcher at ~/.local/bin/claude with your own script or symlink, auto-update leaves it alone and keeps every installed version on disk. To hand control back, remove the launcher and run claude update.

Uninstall

Remove it the way you installed it.

Install method

Command

Native, macOS, Linux, WSL

rm -f ~/.local/bin/claude and rm -rf ~/.local/share/claude

Native, Windows

Remove claude.exe under .local\bin and the .local\share\claude folder with Remove-Item

Homebrew

brew uninstall --cask claude-code or claude-code@latest

WinGet

winget uninstall Anthropic.ClaudeCode

apt

sudo apt remove claude-code, then delete the list and key files

dnf

sudo dnf remove claude-code, then delete the repo file

apk

apk del claude-code, then drop the repository and key

npm

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

Removing the program does not remove your settings. The docs warn that deleting ~/.claude and ~/.claude.json also deletes your settings, allowed tools, MCP server configuration and session history. The VS Code extension, the JetBrains plugin and the Desktop app also write to ~/.claude/, so uninstall them first or the folder comes back.

If claude still runs after you remove it, you probably have a second install or an old shell alias. The troubleshooting page has a "Check for conflicting installations" section for that.

Common install errors and the official fixes

The troubleshooting page is organized by error text. These are the ones people hit most, with the fix the docs give.

What you see

What it means

Fix from the docs

command not found: claude

~/.local/bin is not on PATH

Add it to your shell file, then open a new terminal

syntax error near unexpected token '<'

The download returned a web page, not the script

Retry later, or use Homebrew or WinGet

curl: (22) ... error: 403

A proxy, a firewall or an unsupported region

Check connectivity to downloads.claude.ai first

curl: (56) Failure writing output to destination

The script download was cut off

Retry, or use another method

Killed during install on Linux

The kernel ran out of memory

Add swap, free memory or use a bigger instance

EACCES: permission denied

The target directory is not writable

Fix the directory permissions, or switch to the native installer

TLS connect error

The TLS handshake failed

Update CA certificates, or fix proxy settings

Cask 'claude-code' is unavailable

Your Homebrew index is stale

brew update, then install again

irm is not recognized

You are in CMD, not PowerShell

Use the CMD command instead

The token '&&' is not a valid statement separator

You are in PowerShell, not CMD

Use the PowerShell command instead

Error loading shared library

Wrong binary variant, musl against glibc

See the musl note in the docs

Exec format error in WSL

WSL 1 regression

Convert to WSL 2

A few of these deserve more detail.

PATH. On macOS and Linux, check the file exists with ls -la ~/.local/bin/claude, then check PATH. The fix for Zsh is two lines, one that appends export PATH="$HOME/.local/bin:$PATH" to ~/.zshrc and one that runs source ~/.zshrc. For Bash on Linux use ~/.bashrc. For Bash on macOS use ~/.bash_profile, because Terminal starts Bash as a login shell. Other shells such as fish need their own syntax.

HTML instead of a script. Several different messages mean the same thing: the URL returned a web page. In PowerShell it can look like a parse error full of HTML, or an error naming System.Xml.XmlDocument. The docs list a few causes: network trouble, regional routing, a temporary outage, or a region where Claude Code is unavailable. Waiting a few minutes often fixes it. The alternative install methods reach the same hosts, so if you suspect a proxy, test connectivity first.

Network check. The installer downloads from downloads.claude.ai. The docs give a one-line probe, curl -sI https://downloads.claude.ai/claude-code-releases/latest. A first line showing 200 means you reached the server. On PowerShell call curl.exe, because plain curl is an alias for Invoke-WebRequest and rejects the flags. Behind a corporate proxy, set HTTPS_PROXY and HTTP_PROXY before installing.

Low memory. The installer needs about 512 MB free, and the docs repeat the 4 GB RAM minimum for running the tool. The suggested fix is a 2 GB swap file. Exit code 137 from the installer is the kernel's out-of-memory killer, and the installer prints a message saying so.

Homebrew mismatches. A stale cask index causes the "unavailable" error and can also install an older version than you expected. brew update fixes both. To see which cask you have, run brew list --cask | grep claude-code.

Login errors

What you see

Fix from the docs

OAuth error: Invalid code

The code expired or was cut off. Retry fast, or press c to copy the full URL

API Error: 403 Request not allowed

Check your subscription is active, or that your Console account has the Claude Code or Developer role

Claude Code access has not been granted for this account

An Enterprise owner must grant a role that includes Claude Code

This organization has been disabled with an active plan

An old ANTHROPIC_API_KEY is overriding your login. Unset it and run /status to confirm

Asked to log in again after a session

The token expired. Run /login, and check your system clock

On macOS, if the Keychain rejects writes, Claude Code falls back to a plaintext ~/.claude/.credentials.json file. claude doctor flags it with a warning that starts macOS Keychain is not writable. The documented repair is to unlock the Keychain, resync its password if needed, then run /logout and /login. Logging out removes all stored credentials, including saved MCP server logins, so expect to re-authorize them.

Shared and network drives

One gotcha affects teams. A running session keeps reading parts of the Claude Code executable from disk. If the file disappears mid-session, for example because an NFS home directory was upgraded in place from another machine, the session crashes, and on Linux you see Bus error. The docs say to install on local disk, keep each version in its own directory, delete old versions only when no machine can still run them, and turn off Claude Code's own updates with DISABLE_UPDATES so your tooling controls versions.

Verify the binary

Each release publishes a manifest.json with SHA256 checksums for every platform binary, signed with an Anthropic GPG key. From release 2.1.89 onward the manifest also has a detached signature. The docs walk through importing the key from https://downloads.claude.ai/keys/claude-code.asc, comparing the fingerprint, verifying manifest.json.sig, and checking your binary's hash against the manifest.

Platform signatures cover the rest. The macOS binary is signed by "Anthropic PBC" and notarized by Apple. The Windows binary is signed by "Anthropic, PBC". Linux binaries are not individually code-signed, so use the manifest signature, or let apt, dnf or apk verify the repository key for you.

A short install checklist

  1. Confirm your OS and RAM against the requirements table.
  2. Pick one method. Use the native installer unless you have a reason not to.
  3. Run the command for your shell, and wait through the silent download.
  4. Open a new terminal and run claude --version.
  5. Run claude doctor and read any warnings.
  6. Run claude in a project and sign in with the account type you plan to pay with.
  7. Decide how updates should happen, and write that down for your team.

Our take

Use the native installer on a personal machine. It is the shortest path and it keeps itself current, which matters because the tool changes quickly. Use Homebrew or WinGet only if you want package-manager control, and accept that you now own the upgrades.

For servers and shared images, the apt, dnf and apk repositories are the better fit. They are signed, they follow your normal patching, and the stable channel avoids releases the docs say have major regressions. We have not run these installs ourselves. This guide is built from Anthropic's own documentation, so treat the commands as the vendor's, and read the setup page again if a flag looks different on your day.

If you are still choosing a tool, our Claude Code against Codex comparison and the Claude Code listing are the places to start. When the install works, go to the first-run guide, then look at hooks and adding an MCP server. For the skills side, read how to write a Claude Code skill.

Questions

What is the official way to install Claude Code?

The native installer. On macOS, Linux and WSL run curl -fsSL https://claude.ai/install.sh | bash. On Windows PowerShell run irm https://claude.ai/install.ps1 | iex. Anthropic's setup page marks it as recommended because it updates itself in the background.

Do I need Node.js to run Claude Code?

Not for the native installer, Homebrew, WinGet or the Linux package managers. Only the npm route needs Node.js 22 or later, and even then the installed claude binary does not call Node at runtime.

How do I check that the install worked?

Open a new terminal and run claude --version, which should print a version number followed by (Claude Code). For a fuller check run claude doctor, which prints read-only install and settings diagnostics.

How do I update or remove Claude Code?

Native installs update themselves, and claude update applies an update now. Homebrew, WinGet and Linux package installs update through their own commands. Removal depends on the method, and the setup page lists a command for each.

Sources

  1. code.claude.com/docs/en/setup
  2. code.claude.com/docs/en/troubleshoot-install
  3. code.claude.com/docs/en/authentication
  4. code.claude.com/docs/en/quickstart
  5. code.claude.com/docs/en/skills