A clear, step-by-step tutorial for installing Claude Code on Linux and Unix systems. Works on Ubuntu, Debian, Fedora, Arch, openSUSE, Alpine, WSL2, and the BSDs. About five minutes if Node is already there.
If you've used a terminal before, this page is everything you need.
Claude Code is Anthropic's terminal app. Once it's running, you can type plain English and Claude will read, write, and run code on your machine — refactor a project, organize files, query a database, ship a deploy. It's the same Claude as the web app, but with hands.
Three things make this short: most Linux users already have a terminal they like, package managers handle the dependencies, and the install itself is a single npm command.
Anthropic's recommended install. No Node required. Self-updates. Works on macOS, Linux, and WSL.
curl -fsSL https://claude.ai/install.sh | bash
Then run claude, sign in via the browser link it prints, and you're in. That's the whole install.
Alternatives, in order of preference:
brew install --cask claude-codeclaude --version works after the install, you're done. The five-step Node/npm walk-through below is the original install path and still works — useful if you can't run the native installer for some reason.Claude Code needs Node 18+. Pick the row for your distro. If you already have node --version showing 18+, skip to step 2.
curl -fsSL https://deb.nodesource.com/setup_22.x | sudo -E bash -
sudo apt-get install -y nodejs
sudo dnf install -y nodejs npm
sudo pacman -S nodejs npm
sudo zypper install nodejs22 npm22
sudo apk add nodejs npm
sudo pkg install node npm
curl -o- https://raw.githubusercontent.com/nvm-sh/nvm/v0.40.1/install.sh | bash
# restart shell, then:
nvm install 22
nvm use 22Verify: node --version should print v18.x or higher (we recommend v22).
One command, global install via npm:
sudo npm install -g @anthropic-ai/claude-code
If you used nvm, drop the sudo:
npm install -g @anthropic-ai/claude-code
Verify: claude --version should print a version number.
Run:
claude
The first time, it opens your browser for sign-in. Use the same Anthropic account you'd use at claude.ai. Approve, return to your terminal — you'll see the Claude prompt.
If you're on a headless server (no browser), Claude prints a URL you can open from another machine. Sign in there; the terminal session picks up the credentials automatically.
Try a small, safe one to confirm everything works:
> tell me what files are in this directory and what each one is for
Claude reads, summarizes, and waits for the next thing. Try a real one:
> create a simple Python script that prints today's weather for Austin, TX
Claude proposes the file, asks before writing it, runs it, shows the output.
Type /help to see them all. The handful worth knowing on day one:
/helpLists every built-in command/initGenerates a CLAUDE.md describing the current codebase/reviewReviews the current branch's pending changes/clearClears history, resets the context window/costShows what this session has spent/scheduleSchedules a recurring agent on a cron/exitQuitnpm: command not foundNode didn't install correctly, or your shell hasn't reloaded. Close and reopen the terminal, then re-run node --version. If still missing, re-run the install command for your distro.
EACCES or permission errors during npm install -gYou're hitting npm's classic global-install permission problem. Two fixes:
mkdir ~/.npm-global
npm config set prefix '~/.npm-global'
echo 'export PATH=~/.npm-global/bin:$PATH' >> ~/.bashrc
source ~/.bashrc
Then re-run the install without sudo.Claude prints a sign-in URL. Copy it, open it on any machine with a browser, sign in. The terminal that printed the URL detects success and continues.
WSL2 is fine. A few notes: file edits Claude makes are real Linux files (use /mnt/c/... if you want to touch the Windows side). Browser auth opens your Windows default browser; sign in there.
Set HTTPS_PROXY in your shell before running Claude. Most enterprise setups also need npm's proxy: npm config set proxy http://... and npm config set https-proxy http://....
claude. Pick something small. Don't overthink the first task.