Linux Setup
Prerequisites
You need Node.js v18 or higher and npm.
Step 1: Install Node.js
Option A: Via nodejs.org Download Page with fnm (Recommended)
fnm (Fast Node Manager) is officially recommended by Node.js. It is fast, lightweight, and lets you switch Node versions easily if needed later.
Open your browser and go to nodejs.org/en/download.
You will see a row of dropdowns that says: "Get Node.js vXX.XX.X (LTS) for __ using __ with __". Set the dropdowns as follows:
Dropdown Select Version vXX.XX.X (LTS) -- keep the default LTS version OS Linux Package Manager fnm (under "Recommended (Official)") Package Format npm -- keep the default The page will show you the exact commands to run. Open your terminal and copy-paste them. They will look something like this:
bash# Step 1 -- Install fnm curl -fsSL https://fnm.vercel.app/install | bash # Step 2 -- Restart your terminal or reload your shell profile source ~/.bashrc # or: source ~/.zshrc (if you use zsh) # Step 3 -- Install Node.js fnm install 24 # The page will show the exact version numberINFO
The version number may differ from above -- always use whatever the website shows.
Close and reopen your terminal (or run the
sourcecommand above) so thatfnm,node, andnpmare available.
Why fnm?
It is in the "Recommended (Official)" category on the Node.js download page. Like nvm, it installs Node into your home directory so you never need sudo for npm global installs -- but fnm is significantly faster (written in Rust) and works the same across Windows, macOS, and Linux.
Option B: Using your distro's package manager
This is quicker but may install an older version of Node.js. Check the version after installing -- if it is below v18, use Option A instead.
Ubuntu / Debian:
sudo apt update
sudo apt install -y nodejs npm
# Check the version
node --version # Must be v18 or higherFedora:
sudo dnf install -y nodejs npmArch Linux:
sudo pacman -S nodejs npmOption C: NodeSource (Latest LTS via apt, no nvm)
For Ubuntu/Debian users who want the latest LTS without using nvm:
curl -fsSL https://deb.nodesource.com/setup_lts.x | sudo -E bash -
sudo apt install -y nodejsStep 2: Verify Node.js
node --version
npm --versionBoth should print version numbers. node --version must show v18.x or higher.
Step 3: Install Claude Code
npm install -g @anthropic-ai/claude-codePermission Error?
If you used fnm or nvm: this should not happen. Check that it is active (
which nodeshould point to a path inside your home directory, not/usr/...).If you used a system install: either use
sudo npm install -g @anthropic-ai/claude-codeor fix npm's global directory permissions:bashmkdir -p ~/.npm-global npm config set prefix '~/.npm-global' echo 'export PATH=~/.npm-global/bin:$PATH' >> ~/.bashrc source ~/.bashrc
Step 4: Verify Claude Code
claude --versionYou should see the Claude Code version printed.
Next Step
Head back to Day 0 for authentication setup.
Notes
- WSL (Windows Subsystem for Linux): This guide works inside WSL too. Just follow these steps from your WSL terminal.
- PATH issues: If
claudeis not found after install, ensure npm's global bin is in your PATH. Runnpm config get prefix-- thebin/subdirectory of that path needs to be in your PATH.