Ninja Builder Sign in Get started

How to install Claude Code on Mac, Windows and Linux (with fixes for common errors)

Pick the right install method, check it with claude doctor, and fix the errors people actually hit: PATH, PowerShell policy, old npm copies and WSL sign-in.

By Ninja Builder team9 min read
Title card reading How to install Claude Code, with the install command in a terminal window

Key takeaways

  • Install Claude Code with one command: install.sh on Mac, Linux and WSL, install.ps1 in PowerShell, install.cmd in CMD.
  • The native installer needs no Node.js or admin rights and updates itself; Homebrew, WinGet and Linux packages need manual upgrades.
  • Check the install with claude --version and claude doctor.
  • Most errors are PATH problems, the wrong command for your shell, or an old npm copy that still runs.
  • You need a paid Claude plan (Pro or higher) or a Console account; the free plan doesn't include Claude Code.

To install Claude Code, open a terminal and run Anthropic's one-line installer: curl -fsSL https://claude.ai/install.sh | bash on a Mac, Linux or WSL, or irm https://claude.ai/install.ps1 | iex in Windows PowerShell. Then open a new terminal, run claude --version to check it, and type claude in your project folder to sign in. That is the whole Claude Code install for most people.

This guide goes further than the one-liner. It helps you pick the right install method for your machine, shows how to check that it worked, and walks through the problems people actually hit: command not found, PATH that won't stick, PowerShell blocking scripts, an old npm copy that keeps running, and sign-in that fails inside WSL. Every command comes from Anthropic's setup page and install troubleshooting page, checked on 5 December 2026. Just want the commands? Our Install Claude Code page has them on one screen.

Before you install Claude Code

Check four things first. Most failed installs come from one of them.

  • Your system. macOS 13 or newer, Windows 10 version 1809 or newer (or Windows Server 2019+), Ubuntu 20.04+, Debian 10+ or Alpine Linux 3.19+.
  • Your hardware. 4 GB of RAM or more and an x64 or ARM64 processor. 32-bit Windows is not supported.
  • Your account. Claude Code needs a Pro, Max, Ultra, Team, Enterprise or Console account. The free claude.ai plan does not include it. Companies can also use Amazon Bedrock, Google Cloud's Agent Platform or Microsoft Foundry.
  • Your location and network. An internet connection, in a country Anthropic supports. A company proxy or firewall can block the download.

You do not need Node.js for the recommended installer, and on Windows you don't need administrator rights.

Choose your Claude Code install method

There are several ways to install the same program. The main difference is how it gets updated.

MethodWorks onUpdatesPick it when
Native installer (recommended)macOS, Linux, WSL, WindowsAutomatically, in the backgroundYou want the simplest setup that stays current
HomebrewmacOS (and Linux with Homebrew)Manual: brew upgrade claude-codeYou manage all your tools with Homebrew
WinGetWindowsManual: winget upgrade Anthropic.ClaudeCodeYou manage Windows software with WinGet
apt, dnf or apkDebian, Ubuntu, Fedora, RHEL, AlpineWith your normal system upgradesServers, or machines your IT team manages
npmAny supported platform with Node.js 22+Automatic if npm's folder is writableYou have a reason to keep it in npm; otherwise skip it

If you're not sure, use the native installer. It is what Anthropic recommends, and it avoids most of the problems further down this page.

Install Claude Code on Mac and Linux

  1. Open Terminal (on a Mac, press Command + Space and type Terminal).
  2. Paste the installer and press Enter:
    curl -fsSL https://claude.ai/install.sh | bash
    It shows no progress while it downloads, so give it a minute.
  3. Close the window and open a new one, so your shell picks up the new PATH.
  4. Check it:
    claude --version
    A working install prints a version number followed by (Claude Code).

Prefer Homebrew? Run brew install --cask claude-code. This cask follows the stable channel, which is typically about a week behind and skips releases with major regressions. claude-code@latest gets every release as soon as it ships. Remember that Homebrew installs don't update themselves.

On Alpine and other musl-based systems, install bash and curl first with apk add bash curl, or the installer fails with not found. For apt, dnf and apk repositories, follow the signed-repository steps on Anthropic's setup page, which include checking the signing key's fingerprint.

Install Claude Code on Windows

On Windows you have two choices: native Windows, or inside WSL (Windows Subsystem for Linux). Pick based on where your projects live.

OptionNeedsSandboxed commandsBest for
Native WindowsNothing; Git for Windows optionalNot supportedProjects in normal Windows folders, Windows tools
WSL 2WSL 2 turned onSupportedLinux toolchains, or sandboxed command execution
WSL 1WSL 1 turned onNot supportedOnly if WSL 2 isn't available

For a native install, open PowerShell (your prompt starts with PS C:\) and run:

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

In the older Command Prompt (the prompt starts with C:\ and no PS), use the CMD version instead:

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

Or use WinGet: winget install Anthropic.ClaudeCode. For WSL, open your Linux distribution and run the Mac and Linux command inside it. You install and launch claude inside the WSL terminal, not from PowerShell.

Installing Git for Windows is optional but recommended on native Windows: it gives Claude Code Git Bash for its shell commands. Without it, Claude Code runs commands through PowerShell. Our Claude Code on Windows guide covers the Windows route step by step, including Git Bash setup and WSL tips.

Check that Claude Code installed correctly

Two commands tell you almost everything:

claude --version
claude doctor

claude --version proves the program runs. claude doctor prints a read-only report without starting a session: install health, settings-file errors and warnings with suggested fixes. It also shows whether auto-updates are on and the result of the last update attempt. Run it whenever something seems off; it is the fastest way to find out what Claude Code thinks is wrong.

Sign in and start your first session

  1. Go to your project folder, for example cd ~/projects/my-site.
  2. Run claude.
  3. A browser window opens. Sign in with the Claude account that has your plan, and you're back in the terminal, ready to type a request.

If you've set an ANTHROPIC_API_KEY environment variable and approve it when Claude Code asks, it skips the browser sign-in and bills that Console key instead of your plan. If that isn't what you want, say no when asked.

Claude Code install troubleshooting

Find your error below. If it isn't here, Anthropic's troubleshooting page matches error messages to fixes.

"command not found: claude" or "'claude' is not recognized"

The install worked, but the folder it went into isn't on your PATH. The installer puts claude in ~/.local/bin on Mac and Linux and in %USERPROFILE%\.local\bin on Windows. It says so under Setup notes in its output, but it doesn't change PATH for you.

First, simply open a new terminal window. An old window keeps its old PATH, and a terminal inside an editor such as VS Code takes its PATH from the editor, so quit and reopen the editor too.

Still not found? On a Mac with Zsh (the default), add the folder to your PATH once:

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

On Linux with Bash, use ~/.bashrc in both lines. With Bash on a Mac, use ~/.bash_profile, because macOS Terminal starts Bash as a login shell that ignores ~/.bashrc. Not sure which shell you have? Run echo $0.

In Windows PowerShell, add the folder to your user PATH, then restart the terminal:

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

If the error started right after an update on Windows, the new claude.exe may not have been moved into place. Anthropic's troubleshooting page shows how to restore it from the claude.exe.old.* backup in the same folder.

Errors from running the wrong command for your shell

You seeIt meansDo this
'irm' is not recognizedYou're in CMD, not PowerShellOpen PowerShell, or use the CMD installer
The token '&&' is not a valid statement separatorYou ran the CMD command in PowerShellUse irm https://claude.ai/install.ps1 | iex
A parameter cannot be found that matches parameter name 'fsSL'You ran the Mac/Linux command in PowerShellUse the PowerShell installer
The script's text prints instead of installingYou ran only half the commandPaste the whole line, including | iex

"running scripts is disabled on this system"

This PowerShell error appears when you install or run Claude Code through npm. PowerShell's execution policy blocks the .ps1 launcher scripts npm creates. It doesn't affect the native PowerShell installer, which runs the downloaded text directly. You have three fixes:

  1. Allow locally created scripts for your user, then try again:
    Set-ExecutionPolicy -ExecutionPolicy RemoteSigned -Scope CurrentUser
  2. Call claude.cmd or npm.cmd instead; the policy doesn't cover them.
  3. Better: switch to the native installer, which installs a program rather than a script.

An old npm install keeps running

Two copies of Claude Code on one machine cause version mix-ups: you update one, and your shell keeps starting the other. Check what you have. On Mac and Linux run which -a claude; in PowerShell run where.exe claude. If you see more than one, keep the native install and remove the extras. For a global npm copy:

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

Older versions of Claude Code also made a local npm install in ~/.claude/local; remove it with rm -rf ~/.claude/local (or Remove-Item -Recurse -Force "$env:USERPROFILE\.claude\local" on Windows). If you really want to stay on npm, never use sudo npm install -g: Claude Code updates itself without sudo, so an install that needed it can't update.

"syntax error near unexpected token '<'" or a 403

The install address returned a web page instead of the script. If the output mentions "App unavailable in region", Claude Code isn't offered in your country. Otherwise it is often temporary, or a company proxy blocking the download. Wait a few minutes and retry, or use Homebrew on a Mac or WinGet on Windows instead.

"The process cannot access the file" on Windows

A previous install attempt is still running, or antivirus is scanning a half-downloaded file. Close other PowerShell windows running the installer, then clear the downloads folder and run it again:

Remove-Item -Recurse -Force "$env:USERPROFILE\.claude\downloads"
irm https://claude.ai/install.ps1 | iex

Sign-in fails in WSL, over SSH or in a container

If no browser opens, or the browser shows a localhost connection error, copy the login URL the terminal shows (press c at the prompt), open it in a browser on your computer, sign in, and paste the code it shows back into the terminal. If pasting does nothing, run claude auth login, which reads the code from standard input. In WSL, an exec: node: not found error after an npm install usually means WSL is using the Windows Node.js; the native installer avoids this entirely.

Keep Claude Code up to date

Native installs check for updates when Claude Code starts and while it runs, install them in the background, and use the new version the next time you start it. To update right away, run claude update.

Homebrew, WinGet and Linux package installs don't update themselves by default. Use brew upgrade claude-code, winget upgrade Anthropic.ClaudeCode, or your system's normal upgrade command. Want fewer surprises? Switch to the stable channel in /config under Auto-update channel; it serves a version that is typically about a week old.

Uninstall or reinstall cleanly

To remove a native install on Mac, Linux or WSL:

rm -f ~/.local/bin/claude
rm -rf ~/.local/share/claude

On Windows PowerShell:

Remove-Item -Path "$env:USERPROFILE\.local\bin\claude.exe" -Force
Remove-Item -Path "$env:USERPROFILE\.local\share\claude" -Recurse -Force

Use brew uninstall --cask claude-code, winget uninstall Anthropic.ClaudeCode or npm uninstall -g @anthropic-ai/claude-code for those methods. Your settings, allowed tools, MCP servers and session history live in ~/.claude and ~/.claude.json. Leave them alone if you plan to reinstall; deleting them starts you from scratch.

Prefer not to use a terminal?

Claude Code itself is a terminal program, but you don't have to live in the terminal to use it. Anthropic's Claude desktop app includes Claude Code in a graphical window. Or use a desktop app like Ninja Builder, which runs Claude Code with your own Claude account. If Claude isn't on your computer yet, Ninja Builder gets it ready in the background when you pick Claude as your provider, then opens Anthropic's sign-in page in your browser. You get chats per project, a live Preview of what it builds, a Git panel and usage meters, on Mac, Windows and Linux. Our comparison of Claude Code GUI apps lists the other options too.

Still choosing a tool? Read Claude Code vs Cursor for how the agent compares with an AI editor, or download Ninja Builder to use Claude Code without the console.

Frequently asked questions

How do I install Claude Code?

Open a terminal and run curl -fsSL https://claude.ai/install.sh | bash on Mac, Linux or WSL, or irm https://claude.ai/install.ps1 | iex in Windows PowerShell. Open a new terminal, run claude --version, then run claude in your project to sign in.

Do I need Node.js to install Claude Code?

No. The native installer, Homebrew and WinGet don't need Node.js. Only the npm install method needs Node.js 22 or later.

Why does my terminal say claude is not found after installing?

The install folder (~/.local/bin, or %USERPROFILE%\.local\bin on Windows) isn't on your PATH yet. Open a new terminal first; if it still fails, add that folder to your PATH as shown in this guide.

Is Claude Code free?

The program is free to install, but using it needs a Claude Pro, Max, Ultra, Team or Enterprise plan, or a Console account billed by usage. The free claude.ai plan doesn't include Claude Code.

Should I install Claude Code with npm?

Only if you have a reason to. Anthropic recommends the native installer. If you use npm, never install with sudo, and remove the npm copy if you later switch to the native installer.

Keep reading