§01.02

How to Install Claude Code on macOS & Linux

Install Claude Code with the curl script or Homebrew in under a minute. The npm route now needs Node.js 22+, and a paid Claude plan is required.

published 10 Jun 2026 updated 06 Sept 2026 checked against docs 06 Sept 2026 3 min in Install & set up Markdown

Step 2 of 6 · Get running

On this page4 sections
  1. 1. Run the native installer
  2. 2. Verify the install
  3. 3. Open your project and log in
  4. If it fails

You need: macOS 13.0+ or Ubuntu 20.04+ / Debian 10+ (Alpine and RHEL also supported), 4 GB RAM, and a Claude Pro, Max, Team, Enterprise or Console account. The free Claude.ai plan does not include Claude Code.

1. Run the native installer

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

What it does: installs the native binary and sets up background auto-updates. This is the recommended route on macOS, Linux and WSL.

brew install --cask claude-code

What it does: installs via Homebrew instead. Two casks exist — claude-code tracks the stable channel (about a week behind, skipping bad releases) and claude-code@latest tracks every release. Homebrew installs do not auto-update: run brew upgrade claude-code.

npm still works, but note the change: as of v2.1.198 the npm package requires Node.js 22 or later. It installs the same native binary, which doesn’t use Node at runtime.

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

What it does: installs globally through npm. Never prefix this with sudo.

2. Verify the install

claude --version

What it does: prints a version number followed by (Claude Code). If your shell says command not found, close and reopen the terminal so PATH is picked up — and if it persists, see fix “claude: command not found”.

claude doctor

What it does: prints read-only install and settings diagnostics — install health, settings-file validation errors, and the result of the last update attempt — without starting a session.

3. Open your project and log in

cd ~/path/to/your/project
claude

What it does: starts an interactive session scoped to that folder. A browser opens on first run; sign in with your Claude account, or choose Claude Console to use API billing. Type /login inside a session to switch accounts later.

If it fails

A syntax error near unexpected token '<' or a 403 from the curl command means the script didn’t download — you got an error page instead. Check your network can reach claude.ai and retry rather than piping the result to bash again.

Native installs auto-update in the background; Homebrew and package-manager installs don’t. See how to update Claude Code for the manual commands. Once you’re in, your first session covers what to do with the agent now sitting in your repo.

Source: Claude Code advanced setup.

← All Install & set up plates · Search all guides

↑↓ move↵ openalt+↵ copy first command

Keyboard

⌘/ctrl+K or /
Search all guides
alt+↵
In search: copy the guide's first command
j / k
Move through a list of guides
c
On a guide: copy its first command
t
Toggle light / dark
?
This list