How to Install Claude Code in Linux: Step-by-Step Guide

How to Install Claude Code in Linux: Step-by-Step Guide

Installing Claude Code on Linux can go wrong in all kinds of ways too easily. I’ve had that happen just sitting there, staring at a screen full of errors, going back over every step from some outdated guide and thinking, ” How did this simple thing turn into 45 minutes of debugging? The good news is that Anthropic has significantly simplified the process, and if you follow the right steps in the right order, you’re looking at under 5 minutes from zero to your first active session.

Claude Code is Anthropic’s terminal-based AI coding tool. It doesn’t live in a browser or a chat window. It runs directly in your terminal, reads your actual project files, and works through coding tasks autonomously. Linux is a natural fit; the terminal is already your home, and the native installer is built specifically for Linux distributions.

This guide covers the exact steps to install, verify, and run it. No detours.

[IMAGE: Claude Code install Linux terminal setup guide step by step on Ubuntu]

Why Linux Works So Well with Claude Code

There’s a reason the Linux install experience feels cleaner than other platforms. Anthropic built a native Linux installer. It’s a single-shell command that auto-updates in the background and doesn’t require Node.js or any other dependencies to already be on your machine.
That last point matters more than it sounds. The older npm-based install method, still referenced in some community threads, required Node.js 18+, and getting that sorted on a fresh Linux machine added unnecessary friction. The native installer sidesteps that entirely.

If you’re setting it up for the first time, you can follow this Claude Code AI complete beginner’s guide for a step-by-step walkthrough.

I set this up on an Ubuntu 22.04 machine recently, and the whole process from install to first session took about four minutes. It’s the kind of smooth Linux experience that doesn’t always happen with developer tools.

System Requirements Before You Start

Before you start with the installation, first check that your machine meets the minimum specs. Claude Code isn’t demanding, but it does support specific Linux versions and nothing older.

Linux DistributionMinimum VersionShell Support
Ubuntu20.04+Bash, Zsh
Debian10+Bash, Zsh
Alpine Linux3.19+Bash
WSL (Windows Subsystem)WSL 1 or WSL 2Bash, Zsh

he hardware requirements are modest: 4 GB of RAM minimum, a stable internet connection, and either Bash or Zsh as your shell. Most modern Linux setups already meet this without any changes.

One thing that trips people up before they even start: Claude Code requires a Pro, Max, Teams, Enterprise, or Console account with Anthropic. The free Claude. The AI plan does not include Claude Code access. Worth knowing before you sit down to install.

Supported Distributions for Claude Code Install Linux

Ubuntu and Debian are the smoothest experiences. Most documentation and community answers are written with those two in mind, and the native installer works on both without any extra preparation.

Debian 10+ users occasionally hit a minor issue with an older system version of curl. Running sudo apt update && sudo apt install curl before the main install command resolves it every time.

Alpine Linux requires three packages for the installer to work: libgcc, libstdc++, and ripgrep. Without those, the native binary won’t run. A single APK add libgcc libstdc++ ripgrep command handles all three before you proceed.

This is the method Anthropic officially recommends, and it’s the one I’d point anyone toward first. There is no requirement for Node.js; it auto-updates built in, and it has a clean uninstall if you ever need it.

First, open your terminal, then navigate to your project folder, and run:

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

That single command downloads and installs Claude Code natively on your Linux machine. The installer automatically handles binary placement, path configuration, and auto-update setup all in one go.

After it finishes, run claude –version to confirm the install completed. You should see a version number printed back to you. If that works, installation is done.

[IMAGE: Claude Code installs Linux native installer running in Ubuntu terminal with version output]

Then type claude from inside your project directory to open your first session. It will prompt you to authenticate through your browser, covered in the next section.

Verifying Your Claude Code Install Linux Setup

Very important: do not skip the verification. It just takes 30 seconds and saves you from a confusing situation where the install looked fine, but something wasn’t set up properly.

Run these two commands after installation:

claude --version
claude doctor

The first prints your version number. The second runs a full configuration check and flags any missing or broken components. If Claude’s doctor comes back clean, you’re fully set up.

If the Claude command isn’t found after install, your shell’s PATH probably doesn’t include ~/.local/bin. Add export PATH=” $HOME/.local/bin:$PATH” to your .bashrc or .zshrc, then run source ~/.bashrc to reload it. This line fixes the issue every time.

The npm Method: claude code install linux github Style

The npm method is officially deprecated, but it still works and is worth covering. If you’ve seen it referenced in older GitHub issues, community threads, or documentation repos, this is what people usually mean when they talk about Claude code: a Linux GitHub-style setup installing via the npm package originally published to the registry.

To use it, you need Node.js 18 or higher installed first. Then run:

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

One firm warning directly from Anthropic’s docs: do not use sudo npm install -g. It creates permission issues and introduces security risks. If you hit permission errors, fix your npm configuration rather than reaching for sudo.

The main downside of npm compared to the native installer is that it doesn’t auto-update. You’ll silently fall behind on features and bug fixes without realizing it. The installation of the Claude code Linux experience is genuinely simpler and better maintained using the native curl method. Use npm only if you have a specific reason to.

Authenticating After Installation

Once installed, type claude in your terminal. The first time it runs, it automatically walks you through authentication.

Claude Code opens a browser window and then prompts you to sign in with your Anthropic account. So for that you need an active Pro, Max, Teams, or Enterprise subscription alone to complete this step. Once the authentication is done, the credentials are stored locally, so you won’t be prompted to log in again for future sessions.

If you’re working on a headless server without a browser, there’s an API key-based authentication flow for that scenario. The official documentation at code.claude.com covers the headless setup in detail.

After authentication, navigate into any project directory, type claude, and you’re inside an active working session.

Fixing the Most Common Install Errors on Linux

Most issues that come up during install fall into a small handful of categories, and they’re all fixable quickly.

Command not found after install. This is a PATH issue. Your shell doesn’t know where the Claude binary lives. Add export PATH=” $HOME/.local/bin:$PATH” to your shell config file and reload it with source ~/.bashrc.

Alpine Linux binary errors. Install the required packages first: apk add libgcc libstdc++ ripgrep. Then add USE_BUILTIN_RIPGREP=0 to your settings file. The official documentation covers this configuration in detail.

Authentication keeps looping. If the browser auth redirects without ever completing, clear cookies for claude.ai and try again. Rare, but it happens on certain browser setups.

Curl fails immediately on Debian. Update curl first with sudo apt update && sudo apt install curl, then re-run the install script.

Getting the Most Out of Claude Code on Linux

Completing the Claude Code install on Linux is only the first step. The setup habit that makes the biggest practical difference is simple: always launch Claude Code from inside your actual project directory, not from your home folder.

Claude Code builds its understanding of your codebase from where you start. A session launched from ~/my-project has the full context of everything in that project. A session started from ~ has none of it. That difference shows up immediately in the quality of what it produces.

Linux developers are genuinely well-suited to getting the most out of this tool. The terminal-first design fits naturally into how most of us already work. There’s no browser extension to install, no IDE fork to switch to, just your terminal, your project, and a tool that reads your code before it touches it.

Run the native installer, verify with Claude Doctor, authenticate once, and you’re done. That’s the whole process.

Frequently Asked Questions

How to Install Claude Code on Linux

The cleanest and the easist way to do it is with the native installer. Open your terminal and run: curl -fsSL https://claude.ai/install.sh | Bash. This works on Ubuntu 20.04+, Debian 10+, and Alpine Linux 3.19+, though Alpine requires libgcc, libstdc++, and ripgrep installed first via apk add. After the installation is completed, run claude –version to confirm it worked, then type claude to start a session and authenticate with your Anthropic account through the browser prompt. If you’ve come across older guides recommending the npm method for installing Claude code on Linux, that approach still technically works. Still, the native installer is now deprecated; it’s faster, requires no Node.js dependency, and handles updates automatically in the background. Use the curl method, and you’ll save yourself a few headaches down the lineer, requires no Node.js dependency, and handles updates automatically in the background. Use the curl method and you’ll save yourself a few headaches down the line.

Leave a Comment

Your email address will not be published. Required fields are marked