Home · Read online · Level 2 — Local installation

Chapter L2.2 — Installing Claude Code

Level 2 — Local installation. Product details verified on 21/06/2026 against official sources.

Goal

By the end you will have Claude Code installed on your computer, you will know how to choose the right method for your operating system, and you will have verified that it works. Claude Code is the command-line tool (CLI) that works directly on your project’s files.

Prerequisites

Which method to choose

There are several ways to install, but for almost everyone the choice is simple: the native installer. It doesn’t require Node.js and updates itself in the background. The other methods are for specific cases.

Figure L2.2.1 — Decision tree for the installation method. Alt text: vertical diagram guiding you through choosing the method.

No Yes No Yes I need to install Claude Code Do I manage tools via npm? Native installer recommended Global npm Node.js 18+ On Windows and want WinGet or Homebrew on Mac? Use the native script WinGet / Homebrew manual update

Note: native installer, Homebrew, WinGet and npm all install the same binary. All that changes is how it arrives and how it updates.

Open the terminal and run the command for your system.

macOS, Linux, WSL

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

Windows — PowerShell

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

Windows — CMD

The command goes on a single line; here it is split with ^ for printing.

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

Warning (Windows): if you see the error “The token ‘&&’ is not a valid statement separator” you are in PowerShell, not CMD. The prompt shows PS C:\ in PowerShell and C:\ without PS in CMD.

On native Windows, Git for Windows is optional but recommended: it enables the Bash tool. Without Git, Claude Code uses the PowerShell tool.

Alternative methods

Table L2.2.1 — When to use a different method.

Method Command Update
Homebrew (mac) brew install --cask claude-code manual
WinGet (Win) winget install Anthropic.ClaudeCode manual
npm npm install -g @anthropic-ai/claude-code manual

npm needs Node.js 18+. Golden rule: never sudo npm install -g, because it creates permission problems and security risks. To update, use npm install -g @anthropic-ai/claude-code@latest, not npm update -g.

On Debian/Ubuntu, Fedora/RHEL and Alpine there are also signed repositories (apt, dnf, apk) on downloads.claude.ai: useful in enterprises, they update with the normal system package manager.

In practice: install and verify

  1. Run the native installer command for your system.

  2. Open a new terminal (to reload the PATH).

  3. Check the version:

    claude --version
  4. Run the installation and configuration diagnostics:

    claude doctor
  5. Go into a real project folder (not empty) and start it:

    claude

    On first launch the browser opens for login: follow the instructions.

Common mistakes

Summary

  1. For almost everyone, the native installer is the right choice: no Node, auto-update.
  2. Three different commands for macOS/Linux/WSL, PowerShell and CMD.
  3. npm, Homebrew and WinGet install the same binary, but update manually.
  4. You need a paid account; never sudo with npm.
  5. Always verify with claude --version and claude doctor.

Next step

In ch. L2.3 — Authentication and controls we complete the login, look at using an API key in automated environments, and read the output of claude doctor to solve the most common problems.

Commands verified on code.claude.com/docs/en/setup on 21/06/2026. Runnability in the VM: the installation scripts require a network connection to claude.ai and an account, so they were not run here; the commands are reported faithfully from the official documentation.

Found it useful? Get the whole manual

33 chapters in a single A5 PDF, free and no signup.

↓ Download the free PDF