Kipt

Your prompts and skills, one keystroke away.

Explore

Claude Code on Linux: install, sandbox setup and fixes

Claude Code Linux guide: the native installer, apt, dnf and apk repos, Alpine setup, the bubblewrap sandbox on Ubuntu 24.04, and fixes for common Linux errors.

By the Kipt team · Updated 26 October 2026

To install Claude Code on Linux, run curl -fsSL https://claude.ai/install.sh | bash in a terminal, open a new terminal, and check it with claude --version. Anthropic also publishes signed apt, dnf and apk repositories if you prefer your system package manager, and the optional sandbox needs two extra packages, bubblewrap and socat.

This guide covers supported distributions, every documented install method, Alpine and other musl systems, sandbox setup, signing in on a headless server, and the Linux errors people hit most. It is based on Anthropic's advanced setup docs, sandboxing docs and install troubleshooting page, read on 26 October 2026.

Which Linux distributions does Claude Code support?

Anthropic's system requirements list three Linux distributions by name:

Requirement Documented value
Distributions Ubuntu 20.04+, Debian 10+, Alpine Linux 3.19+
Processor x64 or ARM64
Memory 4 GB+ RAM
Shell Bash, Zsh, PowerShell or CMD (one list for all platforms)
Network Internet connection required
Account Pro, Max, Team, Enterprise or Console; the free claude.ai plan does not include Claude Code

The dnf repository is documented "for Fedora and RHEL", so those distributions have an official package path too. Ripgrep, which Claude Code uses for search, is usually bundled with the binary.

If you want a graphical app instead, the Claude desktop app has a Linux beta for Ubuntu 22.04 or later and Debian 12 or later. Anthropic's desktop Linux page says to run the CLI on non-Debian distributions such as Fedora or Arch.

How do you install Claude Code on Linux?

The recommended path is the native installer:

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

The command shows no progress while it downloads. When it finishes, open a new terminal window and run:

claude --version
claude doctor

A working install prints a version number. claude doctor prints read-only diagnostics, including install health and settings errors, without starting a session.

The installer places a launcher at ~/.local/bin/claude, which is a symlink into ~/.local/share/claude/versions/. Native installs update themselves in the background. You can also pick a channel or version at install time:

# stable channel: typically about a week old, skips releases with major regressions
curl -fsSL https://claude.ai/install.sh | bash -s stable

# a specific version
curl -fsSL https://claude.ai/install.sh | bash -s 2.1.89

An npm package also exists (npm install -g @anthropic-ai/claude-code, Node.js 22 or later). It installs the same native binary. Anthropic warns not to use sudo npm install -g.

Then start Claude Code in your project with claude and follow the browser prompts to sign in. The Claude Code setup guide walks through the first session.

How do you install Claude Code with apt, dnf or apk?

Anthropic publishes signed repositories with two channels each: stable and latest. The commands below use stable. Package manager installs do not auto-update through Claude Code; updates arrive with your normal system upgrades.

On Debian and Ubuntu (install curl and gnupg first if they're missing):

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.asc
gpg --show-keys /etc/apt/keyrings/claude-code.asc
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-code

The fingerprint gpg prints should be 31DDDE24DDFAB679F42D7BD2BAA929FF1A7ECACE.

On Fedora and RHEL:

sudo tee /etc/yum.repos.d/claude-code.repo <<'EOF'
[claude-code]
name=Claude Code
baseurl=https://downloads.claude.ai/claude-code/rpm/stable
enabled=1
gpgcheck=1
gpgkey=https://downloads.claude.ai/keys/claude-code.asc
EOF
sudo dnf install claude-code

On Alpine:

wget -O /etc/apk/keys/claude-code.rsa.pub \
  https://downloads.claude.ai/keys/claude-code.rsa.pub
echo "https://downloads.claude.ai/claude-code/apk/stable" >> /etc/apk/repositories
apk add claude-code

Upgrade later with sudo apt update && sudo apt upgrade claude-code, sudo dnf upgrade claude-code or apk update && apk upgrade claude-code. For the latest channel, swap stable for latest in the repository URL (and, for apt, in the suite name). The Claude Code update guide covers channels in more depth.

When home directories sit on network storage such as NFS, Anthropic suggests putting the binary on each machine's local disk, for example with one of these package managers, because a running session keeps reading its executable from disk. If that file disappears mid-session, Linux reports a Bus error.

What do Alpine and other musl distributions need?

Alpine and other musl-based systems need bash and curl to run the install script, plus libgcc, libstdc++ and ripgrep at runtime:

apk add bash curl libgcc libstdc++ ripgrep

On Alpine, ripgrep is in the community repository, so add that repository to /etc/apk/repositories and run apk update if apk can't find it. Then tell Claude Code to use the system ripgrep in ~/.claude/settings.json:

{
  "env": {
    "USE_BUILTIN_RIPGREP": "0"
  }
}

How do you set up the Claude Code sandbox on Linux?

The sandbox is off by default. When you turn it on, shell commands Claude runs can only write to the working directory and a few allowed paths, and network traffic goes through a proxy that checks each host. On Linux and WSL2 it is enforced by bubblewrap, with socat relaying network traffic. Install both:

# Ubuntu and Debian
sudo apt-get install bubblewrap socat

# Fedora
sudo dnf install bubblewrap socat

Restart Claude Code and run /sandbox. If a required package is missing, the panel shows only a Dependencies tab listing what's absent. An optional seccomp filter adds Unix socket blocking; install it with npm install -g @anthropic-ai/sandbox-runtime.

Ubuntu 24.04 and later. The default AppArmor policy blocks bubblewrap from creating user namespaces. Run sysctl kernel.apparmor_restrict_unprivileged_userns. If it returns 1, add this profile and reload AppArmor:

sudo tee /etc/apparmor.d/bwrap > /dev/null <<'EOF'
abi <abi/4.0>,
include <tunables/global>

profile bwrap /usr/bin/bwrap flags=(unconfined) {
  userns,
  include if exists <local/bwrap>
}
EOF
sudo systemctl reload apparmor

The profile applies only to bwrap itself, not to the commands it runs.

To confirm it works, ask Claude (not the ! prompt) to run touch ~/sandbox-probe. Inside the sandbox it fails with Read-only file system on Linux. Other Linux specifics from the docs:

  • In an unprivileged container, bubblewrap can't mount /proc. Set enableWeakerNestedSandbox to true only if the container is already your isolation boundary.
  • Chromium exits with No usable sandbox! because sandboxed commands can't create user namespaces. Start it with --no-sandbox, or add the test command that launches it to excludedCommands.
  • docker is incompatible with the sandbox; exclude the specific commands you need.

By default, if the sandbox can't start, Claude Code runs commands unsandboxed. Set sandbox.failIfUnavailable to true to make it exit instead. The Claude Code sandbox guide covers modes and settings.

How do you sign in on a Linux server or over SSH?

On a remote machine or in a container, the browser usually opens somewhere else, so the redirect can't reach Claude Code. After you sign in, the browser shows a code: paste it at the Paste code here if prompted prompt. If pasting does nothing, run claude auth login, which reads the code from standard input.

For servers and CI, an API key or a long-lived token often fits better than a browser login. See the Claude Code API key guide and login issues guide.

On Linux, credentials are saved to ~/.claude/.credentials.json with file mode 0600, as the authentication docs describe.

What are the most common Claude Code errors on Linux?

What you see Likely cause Fix
bash: claude: command not found ~/.local/bin isn't on your PATH Add export PATH="$HOME/.local/bin:$PATH" to ~/.bashrc, then source ~/.bashrc
Killed or exit code 137 during install Out-of-memory killer Free memory or add a 2 GB swap file, then rerun; install needs about 512 MB free
Error loading shared library libstdc++.so.6 Wrong musl or glibc binary Check ldd --version; reinstall on glibc, or add the Alpine packages on musl
Illegal instruction Wrong architecture, or a CPU without AVX Check uname -m; on a VM, grep -m1 -ow avx /proc/cpuinfo
Install hangs in Docker Installer run from / scans the whole filesystem Set WORKDIR /tmp before running the installer
Bus error mid-session Executable removed or truncated, often on network storage Start a new session; install on local disk

The Illegal instruction case with no AVX has no native-binary workaround, and alternative install methods download the same binary. For anything else, run claude doctor and check the Claude Code troubleshooting guide. Running Claude Code inside a container is covered in the Claude Code Docker guide.

How do you uninstall Claude Code on Linux?

For a native install, delete the launcher and version files:

rm -f ~/.local/bin/claude
rm -rf ~/.local/share/claude

For package installs, use sudo apt remove claude-code, sudo dnf remove claude-code or apk del claude-code, and remove the repository file you added. Deleting ~/.claude and ~/.claude.json also removes your settings, MCP configuration and session history, so only do that for a full reset.

How do you bring your skills to a new Linux machine?

A fresh server has none of your prompts or Agent Skills. If you keep them in Kipt, they live as Markdown in a private GitHub repo you own, and one command installs every skill into Claude Code on the new box: npx skills add https://github.com/<you>/<repo>.git --all -g. From there, the Claude Code skills guide explains how Claude decides when to use them.

Questions

Does Claude Code run on Linux?

Yes. Anthropic's setup docs list Ubuntu 20.04 or later, Debian 10 or later and Alpine Linux 3.19 or later, on x64 or ARM64 with at least 4 GB of RAM. Install it with curl -fsSL https://claude.ai/install.sh | bash, or from Anthropic's signed apt, dnf or apk repositories.

How do I update Claude Code on Linux?

A native install updates itself in the background, and claude update applies an update right away. Installs from the apt, dnf or apk repositories don't auto-update: upgrade them with your package manager, for example sudo apt update && sudo apt upgrade claude-code.

Why does the Claude Code sandbox fail on Ubuntu 24.04?

On Ubuntu 24.04 and later, the default AppArmor policy stops bubblewrap from creating the user namespaces it needs. If sysctl kernel.apparmor_restrict_unprivileged_userns returns 1, add the AppArmor profile for bwrap from Anthropic's sandboxing docs and reload AppArmor.

Why is the Claude Code install killed on my Linux server?

A Killed message with exit code 137 usually means the Linux out-of-memory killer stopped the install. The installer needs roughly 512 MB of free memory and Claude Code needs at least 4 GB of RAM to run, so free memory, add swap or move to a larger instance, then rerun the installer.

Where does Claude Code store my login on Linux?

On Linux, Claude Code stores credentials in ~/.claude/.credentials.json with file mode 0600. If you set CLAUDE_CONFIG_DIR, the file lives under that directory instead. /login and /logout manage the file for you.

More in Claude Code

All guides

Keep your prompts and skills in one place, in your own GitHub. Install every skill with one command.

Get started

Kipt is an independent product, not affiliated with or endorsed by Anthropic, OpenAI, Cursor or GitHub. Claude, ChatGPT, Codex, Cursor and GitHub are trademarks of their owners.