This guide shows how to install Claude Code, Anthropic's coding agent, on Windows PowerShell, macOS, and Ubuntu, and sign in with your Claude account. It also covers checking the installation, updating, uninstalling, and common installation errors.
1. Requirements
- One of Windows 10 version 1809 or later (or Windows Server 2019 or later), macOS 13.0 or later, or Ubuntu 20.04 or later
- 4 GB of memory or more, and an x64 or ARM64 processor
- An account on a Claude Pro, Max, Team, or Enterprise plan, or a Claude Console account (Claude Code is not available on the free plan)
- An internet connection (available in countries where Anthropic's services are supported)
You can install Claude Code with a single install script, without Node.js, and this is the method the official documentation recommends. When you install with the install script, Claude Code updates itself automatically when a new version comes out. Node.js is needed only if you choose to install with npm (step 6).
2. Install on Windows (PowerShell)
Open PowerShell from the Start menu and run the command below. You don't need to open it as an administrator. If you see PS at the start of the prompt, you are in PowerShell.
irm https://claude.ai/install.ps1 | iexNo progress is shown while it downloads. When the installation finishes, claude.exe is placed in the %USERPROFILE%\.local\bin folder. Close the PowerShell window, open a new one, and check the version. If a version number such as 2.1.311 (Claude Code) appears, it is installed.
claude --versionYou can also install it with WinGet. This method does not update automatically, so you need to run the update command in step 8 from time to time.
winget install Anthropic.ClaudeCode3. Install on macOS
Open Terminal and run the install script.
curl -fsSL https://claude.ai/install.sh | bashThe claude executable is installed to ~/.local/bin/claude, and the actual files are stored by version in the ~/.local/share/claude/versions/ folder. Open a new terminal and check the version.
claude --versionYou can also install it with Homebrew. claude-code is the stable channel: it usually receives new versions about a week after the latest release and skips versions that had major problems. To get new versions right away, install claude-code@latest. When installed with Homebrew, Claude Code does not update automatically.
brew install --cask claude-code4. Install on Ubuntu
Use the same install script as on macOS. Install it with the same command in Ubuntu inside WSL as well.
curl -fsSL https://claude.ai/install.sh | bashThe install script does not change your PATH itself. If you see the message ~/.local/bin is not in your PATH under Setup notes: in the installation output, add it to your PATH with the two commands below. The first line saves the setting to ~/.bashrc so that it also applies to new terminals, and the second line applies it right away to the terminal that is open now. There is no output.
echo 'export PATH="$HOME/.local/bin:$PATH"' >> ~/.bashrc
source ~/.bashrcclaude --versionInstall from the apt repository
If you want to install it the same way on several servers or manage it together with system updates, you can use the apt repository that Anthropic runs. This method also does not update automatically; you update with apt upgrade. The steps below use the stable channel. A freshly installed Ubuntu may not have curl and gpg, so install them first.
sudo apt install curl gnupgDownload the repository signing key.
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.ascCheck that the downloaded key is Anthropic's key. The fingerprint in the output must match 31DDDE24DDFAB679F42D7BD2BAA929FF1A7ECACE.
gpg --show-keys /etc/apt/keyrings/claude-code.ascAdd the repository and install.
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-code5. Check the installation
claude doctor shows the installation status, errors in settings files, and the results of automatic updates without starting a session. If there is a problem, it also shows how to fix it.
claude doctor6. Install with npm (all three OSes)
The npm package requires Node.js 22 or later. If you don't have Node.js, install it first by following the guide below.
- Windows: How to Install Node.js on Windows 11
- Ubuntu: How to Install Node.js with nvm on Ubuntu 24.04 (22.04, 26.04)
- macOS: Download the LTS installer from nodejs.org and install it.
npm install -g @anthropic-ai/claude-code7. First run and sign-in
Run claude in the project folder you want to work in. On the first run, a browser opens; after you sign in with your Claude account, you return to the terminal and an interactive session starts.
cd ~/my-project
claudeIf the browser doesn't open automatically, press c on the sign-in screen to copy the sign-in URL and paste it into a browser. If you sign in with a browser on another computer, such as when you are connected to a server over SSH or using WSL 2, a sign-in code is shown in the browser after you finish signing in. Paste this code into the Paste code here if prompted field in the terminal to complete the sign-in. If pasting doesn't work, sign in with the command below. This command reads the pasted code from standard input.
claude auth loginInside Claude Code, /login signs you in again, /logout signs you out, and /status shows the authentication method you are currently using.
8. Update
If you installed with the install script, Claude Code checks for new versions at startup and while running and updates itself automatically; the new version takes effect the next time you run it. To update right away, run the command below.
claude updateIf you installed it another way, it does not update automatically, so update it with that package manager. For Homebrew, use brew upgrade claude-code (brew upgrade claude-code@latest for the latest channel); for WinGet, use the command below.
winget upgrade Anthropic.ClaudeCodeIf you installed from the apt repository, use the command below.
sudo apt update && sudo apt upgrade claude-codeIf you installed with npm, reinstall it with @latest. npm update -g only updates within the version range you first installed, so it may not bring you to the latest version.
npm install -g @anthropic-ai/claude-code@latest9. Uninstall
If you installed with the install script, delete the executable and the versions folder. On macOS and Ubuntu, run the command below.
rm -f ~/.local/bin/claude
rm -rf ~/.local/share/claudeIn Windows PowerShell, run the command below.
Remove-Item -Path "$env:USERPROFILE\.local\bin\claude.exe" -Force
Remove-Item -Path "$env:USERPROFILE\.local\share\claude" -Recurse -ForceIf you installed it another way, remove it with the command that matches how you installed it.
brew uninstall --cask claude-codewinget uninstall Anthropic.ClaudeCodesudo apt remove claude-code
sudo rm /etc/apt/sources.list.d/claude-code.list /etc/apt/keyrings/claude-code.ascnpm uninstall -g @anthropic-ai/claude-codeTo also delete your settings and conversation history, run the commands below. Your settings, list of allowed tools, MCP server settings, and session history are all deleted. If the VS Code extension or the desktop app is still installed, the folder is created again the next time they run, so remove them first.
rm -rf ~/.claude
rm ~/.claude.jsonRemove-Item -Path "$env:USERPROFILE\.claude" -Recurse -Force
Remove-Item -Path "$env:USERPROFILE\.claude.json" -Force10. Troubleshooting
bash: claude: command not found (in PowerShell: The term 'claude' is not recognized)
Claude Code is installed, but the install folder is not in your PATH, or the terminal was opened before the installation and cannot read the updated PATH. First, open a new terminal. If that doesn't work, on macOS and Ubuntu add ~/.local/bin to your PATH (the two commands in step 4; on macOS with zsh, use ~/.zshrc instead of ~/.bashrc). On Windows, check that %USERPROFILE%\.local\bin is in your user PATH.
'irm' is not recognized as an internal or external command
You ran the command in Command Prompt (CMD), not PowerShell. Open PowerShell from the Start menu and run it again. To install from CMD, run curl -fsSL https://claude.ai/install.cmd -o install.cmd && install.cmd && del install.cmd. Conversely, if you run this CMD command in PowerShell, you get the error The token '&&' is not a valid statement separator.
A parameter cannot be found that matches parameter name 'fsSL'
This error appears when you run the curl -fsSL … | bash command for macOS and Linux in Windows PowerShell. In PowerShell, curl is an alias for a different command (Invoke-WebRequest), so it doesn't accept these options. Run irm https://claude.ai/install.ps1 | iex from step 2.
syntax error near unexpected token `<' or a 403 error stops the installation
This appears when the install URL returns a web page or an error instead of the install script. If you see App unavailable in region in the output, you are connecting from a country where Claude Code is not available. Otherwise, try again after a while, or check whether a company proxy or firewall is blocking the download. You can also install with Homebrew on macOS or WinGet on Windows.
running scripts is disabled on this system
This happens on Windows when you installed with npm and the PowerShell execution policy blocks the .ps1 launcher script that npm created. Allow local scripts for the current user only with Set-ExecutionPolicy -ExecutionPolicy RemoteSigned -Scope CurrentUser, or run it as claude.cmd. If you install with the install script in step 2, this problem does not occur.
Killed (exit code 137) appears during installation on a Linux server
This means the system forcibly stopped the installation because it ran out of memory. Installation needs about 512 MB of free memory. On a server with little memory, create a 2 GB swap file (sudo fallocate -l 2G /swapfile, sudo chmod 600 /swapfile, sudo mkswap /swapfile, sudo swapon /swapfile) and install again. Running Claude Code requires 4 GB of memory or more.
API Error: 403 Request not allowed
This appears when you are signed in but your account does not have permission to use Claude Code. On a Pro or Max plan, check that your subscription is active at claude.ai/settings. With a Console account, you need an administrator to give you the Claude Code or Developer role.
Was this guide helpful? Let us know if anything is wrong or out of date.
Request a correction