2026-07-14

How to Install Claude Code on Mac, Windows & Linux (2026 Guide)

Install Claude Code on macOS, Windows, and Linux with native installer, brew, WinGet, npm, and apt/dnf/apk. Fix zsh: command not found: claude and PATH issues.

This guide covers every supported install path for Claude Code in 2026 — Mac, Windows, Linux — plus the one error that fills search results: zsh: command not found: claude. Commands match the official setup docs; when in doubt, prefer those pages.

Before you install

You need:

  • A supported OS: macOS 13+, Windows 10 1809+ (or Server 2019+), Ubuntu 20.04+ / Debian 10+ / Alpine 3.19+ (other modern Linux works via native installer or packages)
  • 4 GB+ RAM, x64 or ARM64
  • Internet access to claude.ai / downloads.claude.ai
  • An account that can run Claude Code: Pro, Max, Team, Enterprise, or Console/API — the free Claude.ai plan does not include Claude Code (quickstart)

Node is not required for native installers (curl / Homebrew / WinGet and distro packages). The npm install path needs Node 18+.

Two install families:

  1. Native installer (recommended) — no Node required; auto-updates on macOS/Linux
  2. Package managers — Homebrew, WinGet, apt/dnf/apk; or a legacy npm global install if you already live in Node

Install on macOS

Option A — native installer (recommended):

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

This places the launcher at ~/.local/bin/claude (symlink into ~/.local/share/claude/versions/).

Option B — Homebrew:

brew install --cask claude-code
  • claude-code tracks the stable channel (~1 week lag, skips bad releases)
  • claude-code@latest tracks latest as soon as it ships

Homebrew does not auto-update; run brew upgrade claude-code (or @latest) yourself.

Option C — npm (legacy / Node shops):

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

Requires a working Node toolchain. If the binary never appears on PATH, use the command not found section below — community reports still hit claude-code: command not found after a clean npm i -g when the global bin dir is missing from PATH.

Then:

claude

Install on Windows

Pick native Windows or WSL based on where your projects live.

Native Windows

PowerShell (look for PS C:\...):

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

CMD (no PS prefix):

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

If you see The token '&&' is not a valid statement separator, you’re in PowerShell — use the irm command. If 'irm' is not recognized, you’re in CMD — use the curl/install.cmd line.

WinGet:

winget install Anthropic.ClaudeCode

WinGet installs do not auto-update; run winget upgrade Anthropic.ClaudeCode periodically.

Git for Windows is optional but recommended so Claude Code can use the Bash tool. Without it, Claude Code uses PowerShell for shell commands. If Git Bash is installed but not found, set:

{
  "env": {
    "CLAUDE_CODE_GIT_BASH_PATH": "C:\\Program Files\\Git\\bin\\bash.exe"
  }
}

in Claude Code settings. Community Windows threads also flag: install Git first, avoid special-character-only username edge cases, and prefer WSL2 for Linux toolchains.

WSL

Open your WSL distro and run the Linux installer (do not install from PowerShell into WSL):

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

Use WSL2 when you need sandboxing or a Linux toolchain.

Install on Linux

Native installer (most distros):

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

Package managers (signed repos; pick your distro — full steps on setup → Linux package managers):

  • apt (Debian/Ubuntu): add the Claude Code apt source, then sudo apt install claude-code
  • dnf (Fedora/RHEL): add the dnf repo, then install claude-code
  • apk (Alpine): add the apk repo, then install claude-code

Alpine / musl note: install libgcc, libstdc++, and ripgrep, then set USE_BUILTIN_RIPGREP=0 in settings if the built-in ripgrep fails.

apk add libgcc libstdc++ ripgrep

Verify your install

claude --version
claude doctor

claude doctor checks install health, PATH, and recent auto-update attempts. First run of claude walks you through browser login.

Fix: zsh command not found: claude

This is the exact string people paste into search: zsh: command not found: claude (or bash/Windows “not recognized”). Install usually succeeded; PATH did not.

Official diagnosis (troubleshoot install): the native installer puts the binary at:

  • macOS/Linux: ~/.local/bin/claude
  • Windows: %USERPROFILE%\.local\bin\claude.exe

1. Confirm the binary exists

ls -la ~/.local/bin/claude

If missing, re-run the native installer. If you used npm, locate the binary with command -v claude, then check npm prefix -g (binary under <prefix>/bin) and npm root -g for the package install path.

2. Check PATH (macOS/Linux)

echo $PATH | tr ':' '\n' | grep -Fx "$HOME/.local/bin"

No output → ~/.local/bin is not on PATH. For zsh (default on macOS):

echo 'export PATH="$HOME/.local/bin:$PATH"' >> ~/.zshrc
source ~/.zshrc

For bash:

echo 'export PATH="$HOME/.local/bin:$PATH"' >> ~/.bashrc
source ~/.bashrc

Then open a new terminal (or source again) and re-check:

claude --version

3. npm global bin not on PATH

Community reports still show: npm install -g @anthropic-ai/claude-code succeeds, then command not found. Fix:

command -v claude          # empty if not on PATH
npm prefix -g              # e.g. /usr/local — binary lives in <prefix>/bin
npm root -g                # package install location
# add <prefix>/bin to PATH the same way as above

Temporary workaround while you fix PATH:

npx @anthropic-ai/claude-code

4. nvm switched Node versions

With nvm, every Node version has its own global bin directory under ~/.nvm/versions/node/<ver>/bin. Install Claude Code under one version, then nvm use another, and the active shell can no longer find it.

nvm current
which -a claude
npm prefix -g

Reinstall under the active Node version:

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

Or prefer the native installer: its ~/.local/bin location is independent of the active Node version.

5. Windows PATH after PowerShell install

Installer finished, but claude is not found:

$env:PATH -split ';' | Select-String '\.local\\bin'

If empty, append User PATH:

$currentPath = [Environment]::GetEnvironmentVariable('PATH', 'User')
[Environment]::SetEnvironmentVariable('PATH', "$currentPath;$env:USERPROFILE\.local\bin", 'User')

Restart the terminal, then claude --version.

6. Wrong shell on Windows

Running the macOS/Linux curl | bash line inside PowerShell, or irm inside CMD, produces confusing errors — not always “command not found,” but they lead people to reinstall forever. Use the matching install command for the shell you’re in.

7. Conflicting installs

which -a claude

You can have a native binary, a legacy ~/.claude/local/ npm tree, and an npm -g install at once. Prefer one path; remove or deprioritize the others if versions fight.

After installing: run it from anywhere

cd /path/to/your/project
claude

From there: ask what the repo does, make a small edit, commit with a descriptive message. Extend repeatable workflows with Claude Code skills, and check your Claude Code usage and limits before a long run. For pricing and plan fit, see Claude Code pricing (2026). For a product surface aimed at remote control of the same local agent, Claude Code on SeaWork keeps the agent on your machine and puts the control UI on your phone or desktop.

FAQ

Do I need a Claude subscription to install Claude Code? You can install the CLI without a subscription. To use it, you need Pro/Max/Team/Enterprise, Console API credits, or a supported cloud provider. Free Claude.ai alone is not enough.

Can I install Claude Code without npm? Yes. Prefer the native installer (curl / PowerShell) or Homebrew / WinGet / apt/dnf/apk. npm is optional for Node-centric environments.

How do I update Claude Code? Native installs auto-update in the background (or run claude update). Homebrew: brew upgrade claude-code. WinGet: winget upgrade Anthropic.ClaudeCode. Package managers: your distro’s normal upgrade path.

Install failed with 403 or syntax error near unexpected token '<'? The install URL returned HTML instead of a script (network/proxy/region). See Troubleshoot installation for curl 403, proxy env vars, and alternate methods.

Ready to install? Start with the native one-liner for your OS, run claude doctor, then open a real project. If you want the same local agent visible from your phone without re-hosting the repo, download SeaWork.