# How to install Claude Code on macOS, Linux and Windows

> Install commands for every OS, how to check the install, how to update, and the fixes Anthropic's docs list for the most common errors.

URL: https://claudegpt.si/news/claude-code-how-to-install  
Published: 2026-10-27T10:53:02.640Z  
Author: ClaudeGPT Si Newsroom  
Section: Guides  
Topics: Claude Code, Anthropic, Installation, Command line  
Publisher: ClaudeGPT Si

## Key takeaways

- The recommended install is a one-line native installer: curl -fsSL https://claude.ai/install.sh | bash on macOS, Linux and WSL, and irm https://claude.ai/install.ps1 | iex in Windows PowerShell.
- Native installs update themselves; Homebrew, WinGet, npm and Linux package installs need a manual upgrade command, and claude update applies an update at once.
- Anthropic's docs say the free claude.ai plan does not include Claude Code; you need Pro, Max, Team, Enterprise, a Console account or a cloud provider.

Claude Code how to install, in short: open a terminal and run one command: `curl -fsSL https://claude.ai/install.sh | bash` on macOS, Linux and WSL, or `irm https://claude.ai/install.ps1 | iex` in Windows PowerShell. Then run `claude --version` to check it worked. This guide follows Anthropic's [advanced setup page](https://code.claude.com/docs/en/setup) and [quickstart](https://code.claude.com/docs/en/quickstart), as of October 27, 2026. We did not run the commands ourselves; every step below comes from those pages.

By the end you will have Claude Code installed, signed in, and kept up to date, and you will know what to try if the install fails.

## What you need before you install

- **Operating system:** macOS 13.0 or later, Windows 10 1809 or later (or Windows Server 2019 or later), Ubuntu 20.04 or later, Debian 10 or later, or Alpine Linux 3.19 or later.
- **Hardware:** 4 GB of RAM or more, and an x64 or ARM64 processor.
- **Network:** an internet connection, and a location in a [country Anthropic supports](https://www.anthropic.com/supported-countries).
- **Shell:** Bash, Zsh, PowerShell or CMD.
- **An account:** a Claude Pro, Max, Team or Enterprise subscription, a Claude Console account, or access through Amazon Bedrock, Google Cloud's Agent Platform or Microsoft Foundry. The docs say the free claude.ai plan does not include Claude Code. Our guide on [whether Claude is free](https://claudegpt.si/news/is-claude-free) covers what the free plan does include.

On native Windows, [Git for Windows](https://git-scm.com/downloads/win) is optional. With it, Claude Code uses Git Bash for its Bash tool. Without it, Claude Code uses PowerShell instead. WSL setups do not need it.

## How to install Claude Code on macOS, Linux and WSL

The docs recommend the native installer. Run this in a terminal:

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

The command shows no progress while it downloads. When it finishes, open a new terminal window.

If you use Homebrew on macOS, you can run this instead:

```bash
brew install --cask claude-code
```

Homebrew has two casks. `claude-code` follows the stable channel, which is typically about a week behind and skips releases with major regressions. `claude-code@latest` gets new versions as soon as they ship.

On Debian, Ubuntu, Fedora, RHEL and Alpine you can also install from signed apt, dnf or apk repositories. The setup page gives the exact commands for each, including how to check the signing key.

## How to install Claude Code on Windows

Run the command for the shell you are in. You do not need Administrator rights. Your prompt shows `PS C:\` in PowerShell and `C:\` without the `PS` in CMD.

PowerShell:

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

CMD:

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

WinGet is the alternative:

```powershell
winget install Anthropic.ClaudeCode
```

Windows has a second route: WSL. Open your WSL distribution and run the Linux command there, then launch `claude` from the WSL terminal, not from PowerShell or CMD. The docs say WSL 2 supports sandboxing, while native Windows and WSL 1 do not.

## Alpine Linux needs extra packages

Alpine does not include `bash` or `curl`, so the install command fails with a `not found` error until you add them. The docs also list `libgcc`, `libstdc++` and `ripgrep` as runtime requirements:

```bash
apk add bash curl libgcc libstdc++ ripgrep
```

Then set `USE_BUILTIN_RIPGREP` to `0` under `env` in your `settings.json` file.

## How to install Claude Code with npm

You can also use npm, which needs Node.js 22 or later:

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

The docs say the npm package installs the same native binary as the standalone installer. Do not use `sudo npm install -g`; it can cause permission problems.

## How to check that Claude Code installed

Run:

```bash
claude --version
```

A working install prints a version number followed by `(Claude Code)`, such as `2.1.211 (Claude Code)`. For a fuller check, run `claude doctor`. It prints read-only diagnostics without starting a session, including install health, settings errors and suggested fixes.

## How to sign in and start your first session

Open a terminal in your project folder and run:

```bash
cd /path/to/your/project
claude
```

On first use, Claude Code asks you to log in. Follow the prompts in your browser. If you set the `ANTHROPIC_API_KEY` environment variable and approve the key when asked, Claude Code skips the login prompt. Your credentials are stored, so you log in once. To switch accounts later, type `/login` inside a session.

Once you are in, try `what does this project do?` as a first prompt. Type `/help` to see the available commands.

## How to update Claude Code

Native installs update themselves in the background. Claude Code checks on startup and periodically while running, and a new version takes effect the next time you start it. To update right away:

```bash
claude update
```

It reports `Successfully updated from <old version> to version <new version>`, or `Claude Code is up to date` if you are current.

Other install methods do not update themselves by default:

| Installed with | Update command |
| --- | --- |
| Homebrew | `brew upgrade claude-code` or `brew upgrade claude-code@latest`, depending on the cask |
| WinGet | `winget upgrade Anthropic.ClaudeCode` |
| npm | `npm install -g @anthropic-ai/claude-code@latest` (the docs say to avoid `npm update -g`) |
| apt | `sudo apt update && sudo apt upgrade claude-code` |
| dnf | `sudo dnf upgrade claude-code` |
| apk | `apk update && apk upgrade claude-code` |

You can choose a release channel. The default, `latest`, gives you new features as soon as they ship. `stable` uses a version typically about a week old. Set it in `/config` under Auto-update channel, or in `settings.json`:

```json
{
  "autoUpdatesChannel": "stable"
}
```

To turn off background updates, set `DISABLE_AUTOUPDATER` to `"1"` under `env` in `settings.json`. That still allows `claude update`. To block every update path, use `DISABLE_UPDATES` instead.

## Common installation problems

Anthropic's [installation troubleshooting page](https://code.claude.com/docs/en/troubleshoot-install) matches each error message to a fix. These are the most common ones.

### claude: command not found after installing

The install directory is not on your PATH yet. The installer puts `claude` at `~/.local/bin/claude` on macOS and Linux, and at `%USERPROFILE%\.local\bin\claude.exe` on Windows. First open a new terminal window. If that does not help, add the folder to your PATH. For Zsh:

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

For Bash on Linux, use `~/.bashrc` in place of `~/.zshrc`. For Bash on macOS, use `~/.bash_profile`. On Windows PowerShell:

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

Restart the terminal afterward. A terminal inside an editor takes its PATH from the editor, so quit and reopen the editor.

### The install script returns HTML or a 403

Errors such as `syntax error near unexpected token '<'` or `curl: (22) The requested URL returned error: 403` mean the URL returned a web page or an error instead of the script. If the output says "App unavailable in region", Claude Code is not available in your country. Otherwise, retry after a few minutes, check that you can reach `downloads.claude.ai`, or use Homebrew or WinGet instead.

### Wrong command for your Windows shell

If PowerShell says `The token '&&' is not a valid statement separator`, you ran the CMD command in PowerShell. If CMD says `'irm' is not recognized`, you ran the PowerShell command in CMD.

### Permission errors

On macOS and Linux the installer writes to `~/.local/bin`, `~/.local/share/claude` and a few other folders under your home directory. If one is not writable, the docs suggest:

```bash
sudo mkdir -p ~/.local/bin
sudo chown -R $(whoami) ~/.local
```

### Auto-update failed

If the footer shows `Auto-update failed · Run claude doctor`, run `claude update` from your shell.

### Two copies of Claude Code

Several installs can cause version mismatches. Run `which -a claude` (or `where.exe claude` on Windows) to list them, and keep only the native one. To remove an npm copy, run `npm uninstall -g @anthropic-ai/claude-code`.

### Your subscription is not offered at login

Anthropic's [help center article on using Claude Code with Pro or Max](https://support.claude.com/en/articles/11145838-using-claude-code-with-your-pro-or-max-plan) lists these steps: run `/logout`, run `claude update`, restart the terminal fully, then run `claude` and pick the right account. It also warns that an `ANTHROPIC_API_KEY` environment variable overrides your subscription, so usage is billed as API usage instead of counting against your plan.

## How to uninstall Claude Code

For a native install on macOS, Linux or WSL:

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

Homebrew users run `brew uninstall --cask claude-code`, WinGet users run `winget uninstall Anthropic.ClaudeCode`, and npm users run `npm uninstall -g @anthropic-ai/claude-code`. Settings and session history live in `~/.claude`, and removing that folder deletes them.

## Where to go next

Anthropic's quickstart walks through asking questions about your code, making a first change and using Git from the session. If you prefer a graphical interface, the docs also point to a Desktop app that runs Claude Code without the terminal.

## Frequently asked questions

### Is Claude Code free to install?

The software installs without a charge, but Anthropic's docs say you need a Pro, Max, Team, Enterprise or Console account, or a supported cloud provider. The free claude.ai plan does not include Claude Code access.

### How do I update Claude Code?

Run claude update. Native installs also update in the background. Homebrew, WinGet, npm, apt, dnf and apk installs need their own upgrade command, such as brew upgrade claude-code or winget upgrade Anthropic.ClaudeCode.

### How do I check which version of Claude Code I have?

Run claude --version. A working install prints a version number followed by (Claude Code). Run claude doctor for a fuller check of the install and settings.

### Why does my terminal say claude: command not found?

The install folder is not on your PATH yet. Open a new terminal, and if that fails add ~/.local/bin to your PATH (or %USERPROFILE%\.local\bin on Windows), then run claude --version again.

## Sources

- [Advanced setup](https://code.claude.com/docs/en/setup), Anthropic
- [Quickstart](https://code.claude.com/docs/en/quickstart), Anthropic
- [Troubleshoot installation and login](https://code.claude.com/docs/en/troubleshoot-install), Anthropic
- [Using Claude Code with your Pro or Max plan](https://support.claude.com/en/articles/11145838-using-claude-code-with-your-pro-or-max-plan), Anthropic Help Center
