Install & set up

How to Install Claude Code on macOS & Linux

3 min read

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.

Open the full interactive version (with copy buttons) ↗

← All guides