How to install Claude Code on Mac, Windows and Linux
To install Claude Code, open a terminal and run the official installer: curl -fsSL https://claude.ai/install.sh | bash on macOS, Linux and WSL, or irm https://claude.ai/install.ps1 | iex in Windows PowerShell. Open a new terminal, run claude --version to confirm, then run claude inside a project folder to log in. You need a paid Claude plan, a Claude Console account or a cloud provider; the free claude.ai plan does not include Claude Code.
What do you need before you install Claude Code?
Check four things first. They take a minute and explain most failed installs. The list below comes from the Claude Code setup page as of October 2026.
| Requirement | What the docs say |
|---|---|
| Operating system | macOS 13.0 or newer; Windows 10 version 1809 or newer, or Windows Server 2019; Ubuntu 20.04 or newer; Debian 10 or newer; Alpine Linux 3.19 or newer |
| Hardware | 4 GB of RAM or more, on an x64 or ARM64 processor |
| Network | An internet connection is required |
| Shell | Bash, Zsh, PowerShell or CMD |
| Location | A country on Anthropic's supported-countries list |
| Account | A Pro, Max, Ultra, Team or Enterprise plan, a Claude Console account, or a cloud provider such as Amazon Bedrock. The free claude.ai plan does not include Claude Code |
You do not need Node.js for the recommended installer. Claude Code ships as a native binary. Node.js only matters if you choose the npm route below.
If a terminal still feels foreign, the docs have a terminal guide that shows how to open one and paste a command. There is also a desktop app that runs Claude Code without a terminal; this page covers the command-line install, which is the version most guides assume.
Which install method should you use?
Use the native installer unless you have a reason not to. It is the method the docs recommend, and it updates itself in the background. The package-manager routes exist for people who manage software through one tool, and they do not update on their own.
| Method | Command | Updates itself? | Pick it when |
|---|---|---|---|
| Native installer (macOS, Linux, WSL) | curl -fsSL https://claude.ai/install.sh | bash | Yes | You want the default and the least maintenance |
| Native installer (Windows PowerShell) | irm https://claude.ai/install.ps1 | iex | Yes | You are on Windows and use PowerShell |
| Native installer (Windows CMD) | curl -fsSL https://claude.ai/install.cmd -o install.cmd && install.cmd && del install.cmd | Yes | You are on Windows and use CMD |
| Homebrew | brew install --cask claude-code | No | You manage Mac or Linux software with brew |
| WinGet | winget install Anthropic.ClaudeCode | No | You manage Windows software with WinGet |
| apt, dnf or apk | Add Anthropic's signed repository, then install the claude-code package | No | You run Debian, Ubuntu, Fedora, RHEL or Alpine and want system packages |
| npm | npm install -g @anthropic-ai/claude-code | Yes, if the npm directory is writable | You already standardize on npm and have Node.js 22 or newer |
Whatever you pick, install it once. Two copies of Claude Code on one machine, say a native install plus an old npm one, is a common cause of strange version behavior. The update section further down shows how to check.
How do you install Claude Code on macOS, Linux or WSL?
Open a terminal and run the installer script. It prints no progress while it downloads, so give it a minute.
# 1. install curl -fsSL https://claude.ai/install.sh | bash # 2. open a NEW terminal window, then check the version claude --version # 3. optional: read-only diagnostics for the install and your settings claude doctor # 4. start Claude Code inside the project you want to work on cd /path/to/your/project claude
The installer places a launcher at ~/.local/bin/claude. If your shell says the command is not found, that folder is missing from your PATH. The fix is in the troubleshooting table below.
Homebrew has two casks. brew install --cask claude-code follows the stable channel, which is typically about a week behind and skips releases with major regressions. brew install --cask claude-code@latest follows the latest channel. Upgrade with brew upgrade claude-code or brew upgrade claude-code@latest, matching the cask you installed.
Linux package managers. Anthropic publishes signed apt, dnf and apk repositories, each with a stable and a latest channel. The commands below set up the stable channel for Debian or Ubuntu and for Fedora or RHEL, as given in the official setup docs. For Alpine, follow the apk tab on that page, and install bash, curl, libgcc, libstdc++ and ripgrep first.
# Debian / Ubuntu sudo apt install curl gnupg 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 gpg --show-keys /etc/apt/keyrings/claude-code.asc # fingerprint should be 31DDDE24DDFAB679F42D7BD2BAA929FF1A7ECACE 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 # upgrade later: sudo apt update && sudo apt upgrade claude-code # Fedora / RHEL sudo tee /etc/yum.repos.d/claude-code.repo <<'EOF' [claude-code] name=Claude Code baseurl=https://downloads.claude.ai/claude-code/rpm/stable enabled=1 gpgcheck=1 gpgkey=https://downloads.claude.ai/keys/claude-code.asc EOF sudo dnf install claude-code # upgrade later: sudo dnf upgrade claude-code
Do not run the installer with sudo. The native installer works in your home directory and does not need elevated rights.
How do you install Claude Code on Windows?
You have two real choices on Windows: run Claude Code natively, or run it inside WSL, the Windows Subsystem for Linux. You do not need to run as Administrator for either.
| Option | Requires | Sandboxing | Pick it when |
|---|---|---|---|
| Native Windows | Nothing extra; Git for Windows is optional | Not supported | Your projects and tools live on Windows |
| WSL 2 | WSL 2 enabled | Supported | You use Linux toolchains or want sandboxed command execution |
| WSL 1 | WSL 1 enabled | Not supported | WSL 2 is not available to you |
For native Windows, open PowerShell and run the installer. Your prompt reads PS C:\ in PowerShell and C:\ without the PS in CMD, and the two need different commands.
# PowerShell (prompt starts with PS C:\) irm https://claude.ai/install.ps1 | iex # CMD (prompt starts with C:\ and no PS) curl -fsSL https://claude.ai/install.cmd -o install.cmd && install.cmd && del install.cmd # WinGet (does not auto-update) winget install Anthropic.ClaudeCode winget upgrade Anthropic.ClaudeCode # then, in a new terminal claude --version
Git for Windows is optional. With it, Claude Code uses Git Bash for its Bash tool. Without it, Claude Code runs shell commands through PowerShell instead. For WSL, open your Linux distribution and run the Linux command there; install and launch claude inside the WSL terminal, not from PowerShell or CMD.
A longer Windows walkthrough, including WSL setup, is in the guide to Claude Code on Windows.
Can you install Claude Code with npm?
Yes. The npm package needs Node.js 22 or newer and installs the same native binary as the standalone installer.
npm install -g @anthropic-ai/claude-code # upgrade (do not use `npm update -g`) npm install -g @anthropic-ai/claude-code@latest
- Never use `sudo npm install -g`. The docs warn it causes permission problems and security risks, and Claude Code runs npm without
sudowhen it updates itself. - An older Node.js version prints an `EBADENGINE` warning but does not fail, because the installed
claudebinary does not run on your Node.js at runtime. - Your package manager must allow optional dependencies, since the binary arrives as a per-platform optional package.
- On Windows, PowerShell may block the `.ps1` launcher with a
running scripts is disabled on this systemerror. Useclaude.cmd, set the policy withSet-ExecutionPolicy -ExecutionPolicy RemoteSigned -Scope CurrentUser, or switch to the PowerShell installer.
How do you log in the first time?
Logging in happens inside Claude Code, not in the installer. Go to a project folder and run claude. On first launch it opens a browser window for you to sign in.
- Run
cdinto your project folder, thenclaude. - Pick the account type when asked: a Claude subscription (Pro, Max, Ultra, Team or Enterprise), a Claude Console account, or a third-party cloud platform.
- Approve the sign-in in the browser. If no browser opens, press
cto copy the login URL and paste it into one yourself. - If the browser shows a code instead of sending you back, paste it at the
Paste code here if promptedprompt. - Wait for
Login successful, then press Enter. Your credentials are stored, so you do not log in again on later runs.
Two shortcuts skip the browser step. If the ANTHROPIC_API_KEY environment variable is set and you approve the key when Claude Code asks, it uses that key instead. And if you ran claude auth login in your shell earlier, the first session starts already signed in.
To switch accounts or sign in again later, type /login inside a session, or /logout to sign out. What each plan costs, and whether you need one at all, is covered in the Claude Code pricing guide.
How do you check that Claude Code installed correctly?
Run claude --version in a new terminal window. A working install prints a version number followed by (Claude Code). The new window matters: the terminal you installed from may not have picked up the PATH change yet.
For a deeper check, run claude doctor. It prints read-only diagnostics without starting a session: install health, settings-file errors, and the result of the last update attempt. Inside a session, /doctor runs a fuller checkup and proposes fixes that Claude applies after you confirm.
Then give it a first real task. Start with a read-only question about the project, such as asking what the project does, before you ask for any change. The Claude Code tutorial walks through a full first session.
What do you do when the install fails?
Match the message you see to the row below. These fixes come from the official installation troubleshooting page, which lists more cases than fit here.
| What you see | Why | Fix |
|---|---|---|
command not found: claude or 'claude' is not recognized | The install folder is not on your PATH, or you are still in the terminal you installed from | Open a new terminal. If it persists, add ~/.local/bin to PATH (commands below). On Windows the folder is %USERPROFILE%\.local\bin |
syntax error near unexpected token '<', or curl: (22) ... error: 403 | The install URL returned a web page or an error instead of the script. This can mean your country is unsupported or a proxy blocked the download | Retry in a few minutes, check your network and proxy, or install with Homebrew (brew install --cask claude-code) or WinGet (winget install Anthropic.ClaudeCode) |
The token '&&' is not a valid statement separator | You ran the CMD command in PowerShell | Use the PowerShell command: irm https://claude.ai/install.ps1 | iex |
'irm' is not recognized as an internal or external command | You ran the PowerShell command in CMD | Use the CMD command, or open PowerShell |
Killed during install on Linux | The system ran out of memory; the install needs roughly 512 MB free | Close other processes, add swap space, or use a larger server. Claude Code needs at least 4 GB of RAM |
EACCES: permission denied | The target directory is not writable, often after an npm install with a root-owned prefix | Do not use sudo. Switch to the native installer |
running scripts is disabled on this system (Windows, npm) | PowerShell's execution policy blocks .ps1 launchers | Run Set-ExecutionPolicy -ExecutionPolicy RemoteSigned -Scope CurrentUser, or use the PowerShell installer |
OAuth error: Invalid code | The login code expired or was cut off when pasted | Retry quickly, press c to copy the full URL, and open it in your local browser if you are on SSH |
API Error: 403 Request not allowed after login | Subscription inactive, a missing Console role, or a proxy | Check your plan at claude.ai/settings, ask your admin for the Claude Code or Developer role, or review proxy settings |
# does the launcher exist? ls -la ~/.local/bin/claude # macOS with Zsh (the default) echo 'export PATH="$HOME/.local/bin:$PATH"' >> ~/.zshrc source ~/.zshrc # Linux with Bash echo 'export PATH="$HOME/.local/bin:$PATH"' >> ~/.bashrc source ~/.bashrc # Bash on macOS reads ~/.bash_profile instead of ~/.bashrc
When login fails and the cause is unclear, the docs suggest a clean re-authentication: run /logout, close Claude Code, start claude again and sign in once more.
How do you update, pin a version or uninstall Claude Code?
Native installs update themselves in the background and take effect the next time you start Claude Code. Homebrew, WinGet and Linux package-manager installs do not, so upgrade them with the commands in the table. A full walkthrough is in the guide to updating Claude Code.
| Method | Update | Uninstall |
|---|---|---|
| Native | Automatic, or claude update | rm -f ~/.local/bin/claude and rm -rf ~/.local/share/claude |
| Homebrew | brew upgrade claude-code (or claude-code@latest) | brew uninstall --cask claude-code |
| WinGet | winget upgrade Anthropic.ClaudeCode | winget uninstall Anthropic.ClaudeCode |
| apt / dnf | sudo apt update && sudo apt upgrade claude-code / sudo dnf upgrade claude-code | sudo apt remove claude-code / sudo dnf remove claude-code |
| npm | npm install -g @anthropic-ai/claude-code@latest | npm uninstall -g @anthropic-ai/claude-code |
To pick a release channel at install time, pass it to the script: curl -fsSL https://claude.ai/install.sh | bash -s stable installs the stable channel, which is typically about a week old and skips releases with major regressions. A specific version works the same way, for example bash -s 2.1.89. Later you can set "autoUpdatesChannel": "stable" in your settings file, or use /config.
Uninstalling the program leaves your settings and session history in ~/.claude and ~/.claude.json. Delete those only if you want a completely clean slate, because they hold your settings, allowed tools, MCP server configuration and history.
If claude behaves like the wrong version, look for a second install. On macOS or Linux, run which -a claude; on Windows, run where.exe claude. Remove the extra copy and keep one.
What should you do after installing Claude Code?
Install is the easy part. Three things make the first week go better. Run one small, read-only task so you learn what the permission prompts look like. Run /init in a real project to generate a first CLAUDE.md, then edit it down; the guide to writing CLAUDE.md shows what to keep. And decide what you are building.
If you do not have a project, borrow one. The developer tools category on the board holds ideas that other people posted and will never build, and every idea has a generated build prompt you can paste into Claude Code. A small one, such as explaining a cron expression in plain English, fits an afternoon. For the full path from idea to working app, see how to build an app with Claude Code.
Frequently asked questions
How do I install Claude Code?
Open a terminal and run the official installer. On macOS, Linux and WSL that is curl -fsSL https://claude.ai/install.sh | bash. On Windows PowerShell it is irm https://claude.ai/install.ps1 | iex. Then open a new terminal, run claude --version to confirm, and run claude in a project folder to sign in.
Do I need Node.js to install Claude Code?
No. The recommended native installer ships Claude Code as a standalone binary and needs no Node.js. Node.js 22 or newer is only required if you choose the npm route, and even then an older version only prints a warning, because the installed binary does not run on your Node.js.
Is Claude Code free to install?
The installer costs nothing, but using Claude Code requires an account. The docs list a Pro, Max, Ultra, Team or Enterprise plan, a Claude Console account with API credits, or a cloud provider. The free claude.ai plan does not include Claude Code. Current prices are in the pricing guide.
How do I install Claude Code on Windows?
Open PowerShell and run irm https://claude.ai/install.ps1 | iex, or run winget install Anthropic.ClaudeCode. In CMD, use the curl-based install.cmd command from the docs. You can also install inside WSL with the Linux command. Git for Windows is optional; without it Claude Code uses PowerShell as its shell tool.
Why does my terminal say claude: command not found?
The install finished but the folder holding the launcher is not on your PATH, or your terminal predates the install. Open a new terminal first. If that fails, add ~/.local/bin to your PATH in ~/.zshrc or ~/.bashrc and reload the file. On Windows, the folder is %USERPROFILE%\.local\bin.
How do I update Claude Code?
Native installs update automatically in the background. For Homebrew run brew upgrade claude-code, for WinGet run winget upgrade Anthropic.ClaudeCode, and for npm run npm install -g @anthropic-ai/claude-code@latest. Run claude doctor to see the result of the last automatic update attempt.
Created with AI assistance and edited for this site. Examples are illustrative and do not represent customer research. About the publisher.