Installing Claude CLI | Common Steps for macOS, Windows, and Linux
The two questions people most commonly run into when installing claude CLI (Claude Code), Anthropic's command-line tool, are: "Which installation path should I choose for my OS?" and "What do I fix when claude isn't found after installation?" Drawing on Anthropic's official setup documentation, this page consolidates everything in one place: the quickest commands for macOS, Linux, WSL, and Windows; installation via Homebrew, WinGet, apt, dnf, and npm; first-time authentication; how to use claude doctor; and how to repair PATH errors.
Claude's CLI — Claude Code — runs on macOS 13+, Windows 10 1809+, and Linux. Anthropic's recommended approach is the native installer (curl -fsSL https://claude.ai/install.sh | bash or PowerShell's irm). This is the only path that supports background automatic updates, ensuring new features and fixes are applied as quickly as possible.
A Pro / Max / Team / Enterprise / Console subscription is required. The free Claude.ai plan will not pass authentication. You can also install via Homebrew, WinGet, apt, dnf, or npm, but these paths default to manual upgrades. To enable automatic updates through a package manager, set CLAUDE_CODE_PACKAGE_MANAGER_AUTO_UPDATE=1 in settings.json.
The most common pitfalls are claude not being found due to a missing PATH entry, and on Windows, confusing PowerShell with CMD. For the former, check whether ~/.local/bin exists and run claude doctor. For the latter, remember: if irm is unrecognized, you're in CMD; if && is rejected, you're in PowerShell.
目次 (11)
- What Is the Claude CLI — Claude Code Running via the claude Command
- System Requirements — OS Version, RAM, and Subscription
- Installation Path Quick Reference — Pick the Right One-Liner in 10 Seconds
- Quickest Steps for macOS, Linux, and WSL — curl Native Install
- Quickest Steps for Windows — irm Install via PowerShell
- Homebrew and WinGet — Installing via Package Manager
- Linux Package Managers — apt / dnf / apk from Official Repositories
- npm install -g — Installing Alongside a Node.js Project
- First-Time Authentication and claude doctor — From Launch to Connectivity Check
- claude Not Found — Resolving PATH Errors and Multiple Installs
- Updates and Release Channels — When to Use stable vs. latest
What Is the Claude CLI — Claude Code Running via the claude Command
The "Claude CLI" refers to Claude Code, Anthropic's official AI coding environment for the terminal. Once installed, you can run the claude command from your shell to use interactive mode for reading files, or run it non-interactively in headless mode with claude -p "..." source.
Claude comes in three main forms: the browser-based Claude.ai, the desktop app Claude Desktop, and the terminal-based Claude Code. This article covers the terminal version — Claude Code (the claude command). Desktop and Code are independent; if you use both, install them in any order without issue.
System Requirements — OS Version, RAM, and Subscription
Before installing Claude Code, verify that you meet three conditions: hardware, software, and account. The requirements are as follows source.
- OS: macOS 13.0 or later / Windows 10 1809 or later or Server 2019 or later / Ubuntu 20.04 or later / Debian 10 or later / Alpine Linux 3.19 or later
- RAM: 4 GB or more
- CPU: x64 or ARM64 (Apple Silicon, Intel, or ARM64 Windows all supported)
- Network: A constant internet connection is required for authentication and inference
- Shell: Bash, Zsh, PowerShell, or CMD
A Pro / Max / Team / Enterprise / or Console account is required. The Claude.ai free plan will not pass authentication. Operation via third-party API providers — Amazon Bedrock, Google Vertex AI, and Microsoft Foundry — is also supported for those who want to tie it to their own cloud contracts.
Installation Path Quick Reference — Pick the Right One-Liner in 10 Seconds
| Path | Supported OS | Auto-Update | Recommended Use |
|---|---|---|---|
| curl (official recommended) | macOS / Linux / WSL | ✓ | Personal dev machines; when you want automatic updates |
| irm / PowerShell (official recommended) | Windows | ✓ | Personal dev machines (Windows); when you want automatic updates |
| Homebrew | macOS | △ (manual brew upgrade / can be automated via settings.json) |
macOS users who prefer managing tools via a package manager |
| WinGet | Windows | △ (manual winget upgrade / can be automated via settings.json) |
Windows users who prefer managing tools via a package manager |
| apt / dnf / apk | Ubuntu / Debian / Fedora / RHEL / Alpine | △ (manual upgrade) | Servers, CI, dedicated Linux machines |
| npm | macOS / Linux / Windows (Node.js 18+) | △ (manual install@latest) |
When co-locating with a Node.js project |
curl and irm are officially recommended by Anthropic and are the only paths that support background automatic updates. Package manager paths (Homebrew, WinGet, apt, etc.) can be set to auto-update by adding CLAUDE_CODE_PACKAGE_MANAGER_AUTO_UPDATE=1 to settings.json, but they default to manual updates.
Quickest Steps for macOS, Linux, and WSL — curl Native Install
The fastest path for macOS / Linux (Ubuntu, Debian, Fedora, Alpine, etc.) / WSL is Anthropic's official native installer in a single line.
curl -fsSL https://claude.ai/install.sh | bash
This script places the binary at ~/.local/bin/claude, auto-detects your platform, and enables background automatic updates. If you want to pin a specific version or switch release channels, pass arguments as follows.
- Specific version:
curl -fsSL https://claude.ai/install.sh | bash -s 2.1.89 - stable channel (stable release with ~1-week delay):
curl -fsSL https://claude.ai/install.sh | bash -s stable - latest channel (immediate new features):
curl -fsSL https://claude.ai/install.sh | bash -s latest
If ~/.local/bin is not on your shell's PATH after installation, you won't be able to call claude. On zsh, run echo 'export PATH="$HOME/.local/bin:$PATH"' >> ~/.zshrc && exec $SHELL to make the change permanent.
Quickest Steps for Windows — irm Install via PowerShell
The native Windows installation uses PowerShell's irm (an alias for Invoke-RestMethod) source.
irm https://claude.ai/install.ps1 | iex
To pin a specific version or request the stable release, pass arguments via a script block.
- Specific version:
& ([scriptblock]::Create((irm https://claude.ai/install.ps1))) 2.1.89 - stable release:
& ([scriptblock]::Create((irm https://claude.ai/install.ps1))) stable
If you see an error saying irm is not recognized, you are likely running CMD (Command Prompt). In that case, switch to the CMD-specific path.
curl -fsSL https://claude.ai/install.cmd -o install.cmd && install.cmd && del install.cmd
The simplest way to tell them apart: if you get 'irm' is not recognized, you're in CMD; if you get '&&' is not a valid statement separator, you're in PowerShell. The latter is a typical error when you write CMD-style && chaining in PowerShell — replace it with ; to fix it. Installing Git for Windows alongside Claude Code enables the Bash toolset within Claude Code, making tools including grep and rg available.
Homebrew and WinGet — Installing via Package Manager
If you prefer to manage everything through your OS package manager, use Homebrew (macOS) or WinGet (Windows).
brew install --cask claude-code
winget install Anthropic.ClaudeCode
Homebrew offers two casks — claude-code (stable, ~1-week delay) and claude-code@latest (immediate) — so choose based on your update policy. WinGet has a single package; update either with upgrade.
Since these paths do not auto-update by default, if you want to pick up new features immediately, add the following to ~/.claude/settings.json.
{
"env": {
"CLAUDE_CODE_PACKAGE_MANAGER_AUTO_UPDATE": "1"
}
}
WinGet upgrades occasionally fail due to Windows file-locking while Claude Code is running. In that case, a notification will prompt you to run winget upgrade Anthropic.ClaudeCode manually — just follow it.
Linux Package Managers — apt / dnf / apk from Official Repositories
To keep Claude Code running persistently on a server or in CI, official repositories are available for each Linux distribution. The general flow is to trust the signing key first, then install.
For Debian / Ubuntu (apt):
sudo install -d -m 0755 /etc/apt/keyrings
sudo curl -fsSL https://downloads.claude.ai/keys/claude-code.asc \
-o /etc/apt/keyrings/claude-code.asc
echo "deb [signed-by=/etc/apt/keyrings/claude-code.asc] https://downloads.claude.ai/claude-code/apt/stable stable main" \
| sudo tee /etc/apt/sources.list.d/claude-code.list
sudo apt update
sudo apt install claude-code
For Fedora / RHEL (dnf), create /etc/yum.repos.d/claude-code.repo and run sudo dnf install claude-code. For Alpine (apk), place the RSA public key in /etc/apk/keys/, add the repository, then run apk add claude-code.
The GPG key fingerprint is 31DD DE24 DDFA B679 F42D 7BD2 BAA9 29FF 1A7E CACE. Always verify it matches using gpg --show-keys. Skipping signature verification opens a supply-chain attack vector, so do not skip the official repository steps.
npm install -g — Installing Alongside a Node.js Project
If you already have Node.js 18 or later, you can also install via npm source.
npm install -g @anthropic-ai/claude-code
Supported platforms are darwin-arm64, darwin-x64, linux-x64, linux-arm64, linux-x64-musl, linux-arm64-musl, win32-x64, and win32-arm64 — covering everything from Apple Silicon Macs to ARM64 Windows. To update, use npm install -g @anthropic-ai/claude-code@latest (npm update -g may not reach the latest version due to semver constraints and is not recommended).
The biggest pitfall with the npm path is that you must not use sudo npm install -g. Installing to the global area as root causes permission and security problems. Instead, manage Node.js with a user-space manager such as nvm or Volta so that you can run -g installs without sudo.
First-Time Authentication and claude doctor — From Launch to Connectivity Check
Once installation is complete, first run claude --version to confirm the binary is on your PATH, then run claude to start the authentication flow.
- Run
claudein your terminal - Open the displayed URL in your browser and sign in to your Anthropic account
- Paste the authorization code back into the terminal to complete authentication
You can sign in with a Pro, Max, Team, Enterprise, or Console account. Free Claude.ai accounts are rejected. After authenticating, before jumping into a conversation, run claude doctor once. It performs a batch check of ripgrep bundling, PATH, auto-update settings, and subscription status, helping you catch and fix early issues source.
claude Not Found — Resolving PATH Errors and Multiple Installs
If you see "claude: command not found" immediately after installation, the cause is almost always either a missing PATH entry or an older install from a different path taking precedence.
To diagnose PATH issues:
- Run
echo $PATH(or$env:Pathin Windows PowerShell) and review the output - On macOS / Linux, run
ls -la ~/.local/bin/claudeto confirm the binary exists - If it exists but is not on PATH, add
export PATH="$HOME/.local/bin:$PATH"to~/.zshrcor~/.bashrc - Run
exec $SHELLto reload your shell
If you suspect multiple installs, run which -a claude and type -a claude to list all paths, then remove the unwanted ones. On Windows, add %USERPROFILE%\.local\bin to the PATH environment variable and reopen PowerShell. Finish by running claude doctor — if all checks show green, the installation is complete.
Updates and Release Channels — When to Use stable vs. latest
Claude Code updates frequently within non-breaking boundaries. You can control the behavior with autoUpdatesChannel in ~/.claude/settings.json.
{
"autoUpdatesChannel": "latest",
"minimumVersion": "2.1.100"
}
latest(default): Picks up new features immediately. Recommended for personal development and test machines.stable: Receives only the stable release, with an ~1-week delay. Recommended for CI and production machines.minimumVersion: Minimum version used as a compatibility guard.
To disable automatic updates entirely, set env.DISABLE_AUTOUPDATER=1 (manual updates via claude update still work). For production environments where you want full update control, set DISABLE_UPDATES=1 to block all updates and run claude update during maintenance windows. A practical policy is: latest + auto-update for daily development machines, stable + manual update for CI/production servers.