Linux MintUbuntu Based

How To Install Claude Code on Linux Mint 22

Install Claude Code on Linux Mint 22

Claude Code is Anthropic’s AI-powered coding assistant that runs directly inside your terminal, reads your entire codebase, edits files, runs Git workflows, and debugs through plain natural language commands. If you want to install Claude Code on Linux Mint 22 without hitting dependency traps or permission errors, you are in the right place. This guide walks you through every step from a fresh Linux Mint 22 system to a working, authenticated Claude Code session, with exact commands, expected outputs, and fixes for the most common problems.

Linux Mint 22 is built on Ubuntu 24.04 LTS (Noble Numbat), which means it inherits full Debian/apt compatibility and works with the official Claude Code installation path without any special workarounds. The only requirement you need to handle manually is getting the right version of Node.js, since the default apt repository ships an outdated build that falls below the minimum Claude Code requires.

Prerequisites

Operating System

  • Linux Mint 22 (Cinnamon, MATE, or Xfce edition)

Hardware

  • 64-bit processor (Intel or AMD)
  • Minimum 4 GB RAM, 8 GB recommended for large projects
  • At least 500 MB of free disk space
  • Active internet connection

Software

  • Node.js 18 or newer (Node.js 20.x LTS recommended)
  • npm 10.x or higher
  • Git (strongly recommended)
  • curl (pre-installed on Linux Mint 22)

Account

  • An Anthropic account with one of the following: Claude Pro or Max subscription, or a Claude Console account with at least $5 in prepaid API credits

Step 1: Update Your Linux Mint 22 System

The first thing any sysadmin does before installing new software is pull a fresh system update. This avoids dependency conflicts and ensures curl is available for the Node.js setup script.

sudo apt update && sudo apt upgrade -y

The apt update command refreshes your local package index. The apt upgrade -y command applies all pending updates and the -y flag auto-confirms every prompt so you do not have to sit at the keyboard.

Expected output:

Reading package lists... Done
Building dependency tree... Done
0 upgraded, 0 newly installed, 0 to remove and 0 not upgraded.

If you see pending upgrades, let them complete before moving on.

Step 2: Install Node.js and npm on Linux Mint 22

Why You Cannot Use the Default apt Repository

Claude Code is distributed as an npm package, which makes Node.js a hard dependency. The problem is that Linux Mint 22’s default apt repository often ships Node.js version 12 or 16, both of which fall below the required minimum of version 18.

The reliable solution is NodeSource, a third-party repository that packages current Node.js LTS releases for Debian-based systems.

Install Node.js 20.x via NodeSource

curl -fsSL https://deb.nodesource.com/setup_20.x | sudo -E bash -
sudo apt install -y nodejs

The first command downloads the NodeSource setup script and pipes it to bash, which adds the NodeSource repository to your apt sources. The second command installs Node.js 20.x along with npm 10.x from that repository.

Verify Node.js and npm

node --version
npm --version

Expected output:

v20.19.0
10.8.2

If your version shows anything below v18.0.0 for Node.js, stop here and re-run the NodeSource setup script. Do not proceed until the version is correct or Claude Code will silently fail.

Step 3: Configure npm for Correct Permissions

Why This Step Matters

This is the step most tutorials skip, and it is the reason most Linux Mint users end up with broken Claude Code installs.

Running sudo npm install -g writes global npm packages to /usr/local/lib, a system-owned directory. This creates two real problems: it forces every future npm global install to require root access, and it can corrupt your home directory’s file ownership over time.

The fix is to point npm at a directory inside your home folder where you already have full write access.

Set Up a User-Level npm Global Directory

mkdir -p ~/.npm-global
npm config set prefix ~/.npm-global
echo 'export PATH=$HOME/.npm-global/bin:$PATH' >> ~/.bashrc
source ~/.bashrc

Here is what each line does:

  • mkdir -p ~/.npm-global creates the target directory (the -p flag skips the error if it already exists)
  • npm config set prefix ~/.npm-global tells npm to install global packages there instead of the system directory
  • The echo command appends the new directory to your PATH so the shell can find installed binaries
  • source ~/.bashrc reloads your shell configuration so the PATH change takes effect immediately

Linux Mint 22 uses bash as the default shell in the Cinnamon, MATE, and Xfce desktop environments, so .bashrc is always the correct target file here.

Verify the Configuration

npm config get prefix

Expected output:

/home/yourusername/.npm-global

If you see /usr/local or /usr, redo the npm config set command before continuing.

Step 4: Install Claude Code on Linux Mint 22

You have two installation methods available. Method 1 is what Anthropic now recommends as of 2026.

Method 1: Native Installer (Recommended)

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

This one-line command downloads and runs Anthropic’s official installer script. It places a self-contained binary in ~/.local/bin/claude, automatically adds it to your PATH, and handles background auto-updates without any additional configuration.

Method 2: npm Install (Alternative)

Use this method if the native installer fails or if you want manual control over the installed version.

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

The -g flag installs Claude Code globally into your ~/.npm-global/bin directory, which is already in your PATH from Step 3.

Critical rule: never add sudo in front of this command. If you see a permission error, it means Step 3 was not completed correctly, not that you need root access. Go back and fix the npm prefix before retrying.

Verify the Installation

claude --version

Expected output:

1.x.x (claude-code)

Then run the built-in diagnostics:

claude doctor

This command checks your PATH, authentication status, Node.js version compatibility, and any missing optional dependencies. Read every line of the output and address any failures before continuing.

Step 5: Install Optional but Recommended Dependencies

These two tools are not strictly required, but they make Claude Code significantly more useful on real projects.

sudo apt install -y git ripgrep

Git enables Claude Code’s most powerful workflow features: generating commit messages, creating branches, resolving merge conflicts, and opening pull requests through natural language prompts.

ripgrep (the rg command) is a high-speed file search tool that Claude Code uses automatically when it detects the binary in your PATH. On projects with thousands of files, ripgrep makes the difference between a fast, accurate search and a slow, incomplete one.

Verify both are installed:

git --version
rg --version

Step 6: Authenticate Claude Code

Launch Your First Session

Navigate to a real project directory before starting Claude Code. The tool reads your project files for context, so dropping it into an empty directory gives it nothing useful to work with.

cd ~/projects/your-project
claude

On the first launch, Claude Code walks you through a one-time authentication flow.

Authentication Option 1: Claude Pro or Max Subscription

This is the better choice for daily development use at a flat monthly rate.

When the prompt appears, select “Claude account with subscription”, authorize in the browser window that opens, grant the required permissions, and paste the authorization code back into the terminal. Your credentials are stored locally after this first login, so future sessions launch immediately.

Authentication Option 2: Anthropic Console (API Key)

Use this option if you prefer pay-per-use billing or are testing Claude Code before committing to a subscription.

  1. Visit console.anthropic.com and sign in or create an account
  2. Navigate to API Keys and click Create Key
  3. Copy the generated key (it starts with sk-ant- and will not be shown again)
  4. Add at least $5 in prepaid credits under Billing
  5. When Claude Code prompts, select “Anthropic Console account” and authorize in the browser

Step 7: Run Your First Claude Code Session on Linux Mint 22

You are now fully set up. Here is how to get immediate value from your Claude Code on Linux Mint 22 setup.

Explore an Unfamiliar Codebase

Start with exploration before asking Claude to change anything. These four prompts are the recommended first steps from the official quickstart:

what does this project do?
what technologies does this project use?
where is the main entry point?
explain the folder structure

Claude Code reads your files automatically and gives accurate, project-specific answers.

Request a Code Change

add input validation to the registration form handler

Claude Code will show you a diff of every proposed file change and ask for your approval before writing anything to disk. You are always in control of what gets modified.

Generate a Git Commit

commit these changes with a descriptive message

Claude Code analyzes your staged changes, writes a clear commit message following conventional commit format, and runs git commit after your approval.

Essential Commands Reference

Here is a quick reference table for the commands you will use most often as part of your configure Claude Code on Linux Mint 22 workflow:

Command What It Does
claude Start an interactive session
claude "task" Run a one-time task and exit
claude -p "query" Run a query in non-interactive mode
claude -c Continue the last conversation
claude commit Generate and run a Git commit
/help Show all available commands
/clear Clear conversation history
/cost Show token usage and estimated cost
/logout Log out of the current account
exit or Ctrl+C Exit Claude Code

Pressing ? inside a session shows keyboard shortcuts. Tab provides command completion for slash commands.

Troubleshooting Common Issues

Error 1: “command not found: claude” After Installation

Cause: Your PATH does not include the directory where Claude Code was installed.

Fix:

echo $PATH

Look for either $HOME/.npm-global/bin (npm install method) or $HOME/.local/bin (native installer method). If either is missing, add the correct one:

echo 'export PATH=$HOME/.npm-global/bin:$PATH' >> ~/.bashrc
source ~/.bashrc

Then run claude --version again.

Error 2: EACCES Permission Error During npm Install

Cause: npm is still configured to write to a system-owned directory.

Fix: Do not add sudo. Instead, complete Step 3 of this guide to reconfigure the npm prefix, then reinstall:

npm config set prefix ~/.npm-global
npm install -g @anthropic-ai/claude-code

Error 3: Authentication Failure on First Launch

Cause: Expired session token, incorrect credentials, or zero API credits on the Console account.

Fix:

claude
/logout
/login

Then check your billing status at console.anthropic.com. If you are on the API key plan, confirm your credit balance is above zero before retrying.

Error 4: Node.js Version Too Old

Cause: The system still has the old Node.js from the default apt repository.

Fix: Remove the old version and reinstall from NodeSource:

sudo apt remove nodejs npm
curl -fsSL https://deb.nodesource.com/setup_20.x | sudo -E bash -
sudo apt install -y nodejs
npm install -g @anthropic-ai/claude-code

Error 5: claude doctor Reports Failures

Cause: Varies by failure type, but most issues relate to PATH configuration or missing optional tools.

Fix: Read each failure line carefully. PATH issues resolve by following the Step 3 fix above. Missing ripgrep resolves with:

sudo apt install -y ripgrep

Address each reported item one at a time before retrying.

Congratulations! You have successfully installed Claude Code. Thanks for using this tutorial for installing Claude Code on your Linux Mint 22 system. For additional help or useful information, we recommend you check the official Claude Code website.

VPS Manage Service Offer
If you don’t have time to do all of this stuff, or if this is not your area of expertise, we offer a service to do “VPS Manage Service Offer”, starting from $10 (Paypal payment). Please contact us to get the best deal!

r00t

r00t is a dedicated and highly skilled Linux Systems Administrator with over a decade of progressive experience in designing, deploying, and maintaining enterprise-grade Linux infrastructure. His professional journey began in the telecommunications industry, where early exposure to Unix-based operating systems ignited a deep and enduring passion for open-source technologies and server administration.​ Throughout his career, r00t has demonstrated exceptional proficiency in managing large-scale Linux environments, overseeing more than 300 servers across development, staging, and production platforms while consistently achieving 99.9% system uptime. He holds advanced competencies in Red Hat Enterprise Linux (RHEL), Debian, and Ubuntu distributions, complemented by hands-on expertise in automation tools such as Ansible, Terraform, Bash scripting, and Python.
Back to top button