Skip to main content

How to Install Claude Code

Install Claude Code on macOS, Windows or Linux. A clear step-by-step guide to the native installer, npm, first login, updating, and fixing common errors.

Hosna Kachooee By Hosna Kachooee Updated August 2026

Claude Code is Anthropic’s terminal-based coding agent. Installing it takes a couple of minutes, and the native installer is the simplest path on every platform. Here is how to get it running and log in for the first time.

Check the requirements

Before you install, make sure your machine meets the basics:

  • Operating system: macOS 13.0+, Windows 10 (1809+) or Windows Server 2019+, Ubuntu 20.04+, Debian 10+, or Alpine Linux 3.19+.
  • Hardware: 4 GB or more of RAM, on an x64 or ARM64 processor.
  • A terminal: Bash, Zsh, PowerShell or CMD all work.
  • An account: a Claude Pro, Max, Team or Enterprise subscription, or a Claude Console account. The free plan does not include Claude Code.
  • A network connection: Claude Code talks to Anthropic’s servers to work.

This is the method Anthropic recommends. It installs a standalone binary and keeps itself up to date automatically, so you do not need Node.js.

On macOS, Linux or WSL, run:

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

On Windows PowerShell, run:

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

On Windows CMD, run:

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

On macOS and Linux the installer places the launcher at ~/.local/bin/claude. If a PS C:\ prompt rejects the CMD command, you are in PowerShell, not CMD, so use the PowerShell line instead.

Prefer a package manager? On macOS you can use Homebrew with brew install --cask claude-code, and on Windows you can use winget install Anthropic.ClaudeCode. Note that these do not auto-update, so you will need to upgrade them manually.

Install with npm (alternative)

If you would rather manage Claude Code as a global npm package, and you have Node.js 22 or later installed, run:

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

This installs the same native binary as the standalone installer. One important warning: do not use sudo npm install -g, which leads to permission problems and security risks. If you hit permission errors, fix your npm setup rather than reaching for sudo.

Verify the installation

Confirm it worked by checking the version:

claude --version

A working install prints something like 2.1.211 (Claude Code). For a fuller health check of your install and settings, run:

claude doctor

This prints read-only diagnostics without starting a session, which is handy if anything looks off.

Start Claude Code and log in

Move into a project folder and start the interactive session:

cd /path/to/your/project
claude

On first run you will be prompted to log in. For a Claude subscription or Console account, follow the prompts to finish authentication in your browser. If you have set the ANTHROPIC_API_KEY environment variable, Claude Code skips the browser and asks you to approve that key instead. Your credentials are saved after the first login, so you will not need to repeat it. To switch accounts later, type /login inside a running session.

Once you are in, try a first prompt like “what does this project do?” to see it read your codebase. Type /help at any time for the list of commands.

Keep Claude Code updated

Native installations update themselves in the background, taking effect the next time you start Claude Code. To apply an update immediately, run:

claude update

Homebrew, WinGet and Linux package-manager installs do not auto-update. Upgrade those manually, for example brew upgrade claude-code, winget upgrade Anthropic.ClaudeCode, or for npm, npm install -g @anthropic-ai/claude-code@latest.

Fix common install issues

A few problems come up often:

  • claude: command not found: your shell has not picked up the install directory. Close and reopen your terminal, then try claude --version again. If it still fails, run claude doctor.
  • Permission errors on npm: this usually means the npm global directory is not writable, or you used sudo. Avoid sudo npm install -g and fix your npm permissions instead.
  • Wrong Windows shell: if a command reports The token '&&' is not a valid statement separator, you are in PowerShell; if it reports 'irm' is not recognized, you are in CMD. Match the command to your shell.
  • Search failures: Claude Code bundles ripgrep, but on Alpine or other musl-based systems you may need to install ripgrep yourself and set USE_BUILTIN_RIPGREP to 0.

Keep going

With Claude Code installed, the next step is learning to drive it well. Start with the Claude Code hub, then explore slash commands for quick actions, memory and CLAUDE.md to give it lasting project context, and connecting MCP servers to extend what it can do. If you are newer to working with AI tools, our AI course covers the fundamentals, and you can start with the free lessons too.

Frequently asked questions

Do I need a paid plan to use Claude Code?

Yes. Claude Code needs a Claude Pro, Max, Team or Enterprise subscription, or a Claude Console (API) account with credits. The free Claude.ai plan does not include Claude Code access. You can also connect it to a cloud provider like Amazon Bedrock, Google Cloud or Microsoft Foundry.

Should I install with the native installer or npm?

The native installer is recommended. It downloads a standalone binary and updates itself in the background, so you do not need Node.js. Use npm only if you prefer managing it as a global package, which requires Node.js 22 or later.

The 'claude' command isn't found after installing. What do I do?

Your shell PATH probably hasn't picked up the install location yet. Close and reopen your terminal, then run 'claude --version'. If it still fails, run 'claude doctor' for diagnostics, and avoid installing the npm package with sudo, which causes permission problems.

Start free

Get free access to our beginner courses

Drop your email and we'll let you know the moment each free course is live - plus new courses and deals. No spam, unsubscribe anytime.

Master Claude Code from start to finish

This is one lesson from a much larger course. Get the full course with a single one-time payment and lifetime access.

Explore our AI course