Claude Code is most useful on Ubuntu when it can work from the same terminal where you already run Git, tests, package managers, and project scripts. The cleanest way to install Claude Code on Ubuntu is still Anthropic’s native installer, but Anthropic now also publishes a signed APT repository for users who want updates to stay inside the normal Ubuntu package workflow.
These instructions cover Ubuntu 26.04 LTS (Resolute Raccoon), Ubuntu 24.04 LTS (Noble Numbat), and Ubuntu 22.04 LTS (Jammy Jellyfish), including Ubuntu Server and minimal cloud images. Claude Code needs internet access, a supported Claude account, 4 GB or more of RAM, and an x64 or ARM64 system. Ubuntu’s default repositories do not contain claude-code, so sudo apt install claude-code only works after you add Anthropic’s official repository.
Install Claude Code on Ubuntu
Choose one installation method and keep the matching update and removal commands later in the guide. The native installer is the best default for most Ubuntu workstations and servers, while the APT repository is useful when you want package-manager visibility and repeatable fleet setup.
| Method | Channel | Version Behavior | Updates | Best For |
|---|---|---|---|---|
| Native installer | Anthropic setup docs | Latest by default, with stable or pinned targets available | Claude Code background updater | Most Ubuntu desktops, servers, and SSH systems |
| Anthropic APT repository | Signed APT repo | Stable channel by default, latest channel optional | apt package upgrades | Package-managed systems and scripted deployments |
| Homebrew | Homebrew Cask | Stable cask, with claude-code@latest available | brew upgrade | Users already managing CLI tools with Homebrew |
| npm | Anthropic setup docs | Follows npm dist-tags and optional native binary packages | npm update | Existing Node.js 18 or newer global-package workflows |
If you searched for a Claude Code download for Ubuntu, use the native installer or the APT repository rather than a manually downloaded .deb, AppImage, or tarball. Anthropic publishes Linux binaries behind the installer, package repositories, Homebrew casks, and npm optional dependencies; those supported channels keep verification and updates tied to managed paths.
If you searched for the Claude CLI on Ubuntu, the Linux tool you want is Claude Code, the terminal client that launches with claude. Claude Desktop is a separate product surface. Anthropic’s Desktop documentation currently lists macOS and Windows downloads and states that Linux is not supported, so Ubuntu users should use the terminal CLI, the web interface, or remote SSH access from a supported desktop instead.
Claude Code access requires Claude Pro, Max, Team, Enterprise, Claude Console, or a supported cloud-provider account. The free Claude.ai plan does not include Claude Code access.
Install Claude Code with the Native Installer
The native installer places the claude launcher in your home directory and lets Claude Code update itself without depending on Node.js or APT. Install the curl command in Linux first if you are on Ubuntu Server, a minimal VM, or another image where it is not already present.
sudo apt update
sudo apt install curl -y
These commands use
sudofor package installation. If your account is not in the sudoers file yet, follow the guide on how to add a new user to sudoers on Ubuntu before continuing.
Run the official installer from Anthropic:
curl -fsSL https://claude.ai/install.sh | bash
Relevant output includes the selected release and launcher path. The exact version changes as Anthropic publishes new builds.
Setting up Claude Code... Installing Claude Code native build latest... Setting up launcher and shell integration... Claude Code successfully installed! Version: 2.1.x Location: ~/.local/bin/claude
If your shell cannot find claude after the install, add ~/.local/bin to your Bash startup file in a rerun-safe way, then reload the shell.
touch ~/.bashrc
grep -qxF 'export PATH="$HOME/.local/bin:$PATH"' ~/.bashrc || echo 'export PATH="$HOME/.local/bin:$PATH"' >> ~/.bashrc
source ~/.bashrc
Zsh users can place the same export line in ~/.zshrc after they install Zsh on Ubuntu.
Confirm the CLI is available:
claude --version
2.1.x (Claude Code)
The native installer also accepts a release channel. Use stable when you want the delayed channel, or keep the default latest channel for the newest features.
curl -fsSL https://claude.ai/install.sh | bash -s stable
curl -fsSL https://claude.ai/install.sh | bash -s latest
Install Claude Code with the Anthropic APT Repository
The APT repository is the right fit when you want Ubuntu to track the installed package, show the source in apt-cache policy, and update Claude Code through package-manager commands. The repository publishes amd64 and arm64 packages.
Install the tools needed to download and verify the signing key:
sudo apt update
sudo apt install curl ca-certificates gnupg -y
Download Anthropic’s release signing key and store it as an APT keyring:
curl -fsSL https://downloads.claude.ai/keys/claude-code.asc | sudo gpg --dearmor --yes -o /usr/share/keyrings/claude-code.gpg
Verify the fingerprint before trusting the repository:
gpg --show-keys --fingerprint /usr/share/keyrings/claude-code.gpg
pub rsa4096 2026-03-30 [SCE]
31DD DE24 DDFA B679 F42D 7BD2 BAA9 29FF 1A7E CACE
uid Anthropic Claude Code Release Signing <security@anthropic.com>
Add the repository with a DEB822 source file:
printf '%s\n' \
'Types: deb' \
'URIs: https://downloads.claude.ai/claude-code/apt/stable' \
'Suites: stable' \
'Components: main' \
"Architectures: $(dpkg --print-architecture)" \
'Signed-By: /usr/share/keyrings/claude-code.gpg' \
| sudo tee /etc/apt/sources.list.d/claude-code.sources > /dev/null
The example uses Anthropic’s stable channel. To follow the rolling latest channel instead, change both stable values in the source file to latest.
Refresh APT metadata and confirm Ubuntu sees the package from Anthropic:
sudo apt update
apt-cache policy claude-code
Get:1 https://downloads.claude.ai/claude-code/apt/stable stable InRelease [2,925 B]
Get:2 https://downloads.claude.ai/claude-code/apt/stable stable/main amd64 Packages [710 B]
claude-code:
Installed: (none)
Candidate: 2.1.112-1
Version table:
2.1.112-1 500
500 https://downloads.claude.ai/claude-code/apt/stable stable/main amd64 Packages
Install Claude Code from the new repository:
sudo apt install claude-code -y
Verify both the shell command and the installed Debian package version:
claude --version
dpkg-query -W claude-code
2.1.112 (Claude Code) claude-code 2.1.112-1
Install Claude Code with Homebrew
Use Homebrew only when it already manages the rest of your CLI stack. If you still need Homebrew itself, the guide to install Homebrew on Ubuntu covers the bootstrap, and Ubuntu systems also need install Git on Ubuntu before Homebrew can finish its own setup.
Install the stable cask:
brew install --cask claude-code
Homebrew also publishes claude-code@latest if you want the rolling channel instead of the delayed stable cask:
brew install --cask claude-code@latest
After Homebrew links the binary into its prefix, verify the CLI from a shell where brew shellenv is loaded:
claude --version
2.1.x (Claude Code)
Homebrew installations do not use Claude Code’s background updater, so keep upgrades inside the Homebrew workflow.
Install Claude Code with npm
The npm package is still active, but it is best for users who already manage global developer tools with Node.js. Claude Code requires Node.js 18 or newer for this method; Ubuntu 26.04 and 24.04 provide a new enough nodejs package from Ubuntu’s Universe repository, while Ubuntu 22.04’s default nodejs package is still 12.x.
If you need a current runtime first, the guide to install Node.js on Ubuntu covers the supported upgrade paths. Once Node.js 18 or newer is available, keep npm’s global prefix inside your home directory so the install works without sudo:
mkdir -p ~/.local
npm config set prefix ~/.local
npm install -g @anthropic-ai/claude-code
The
npm config set prefix ~/.localstep moves global npm packages into your home directory, which avoids theEACCESerrors Ubuntu returns when a normal user tries to write into/usr/local. Do not usesudo npm install -ghere.
Verify the binary directly first if your shell has not reloaded ~/.local/bin yet:
~/.local/bin/claude --version
2.1.x (Claude Code)
Authenticate Claude Code on Ubuntu
Claude Code needs an account before it can send prompts, read project context, or apply changes. Claude Pro, Max, Team, Enterprise, Claude Console, Amazon Bedrock, Google Vertex AI, and Microsoft Foundry accounts are valid paths, but each provider uses a different sign-in flow.
Sign In to Claude Code
Open a terminal inside the repository you want Claude Code to work with, then start the interactive session:
cd ~/your-project
claude
Claude Code opens a browser login flow on first launch. If no browser appears, press c to copy the login URL and open it manually. On Ubuntu Server, over SSH, or in a headless VM, copy that URL into a browser on your workstation instead of trying to open a browser inside the remote shell.
Cloud-provider accounts do not use the same browser-based Claude.ai flow. Set the provider environment variables for Amazon Bedrock, Google Vertex AI, or Microsoft Foundry first, then run claude.
Check Claude Code Authentication Status
Use the CLI status command any time you want to confirm whether this shell is already authenticated:
claude auth status --text
Not logged in. Run claude auth login to authenticate.
After login, the same command returns account details. You can also start or reset authentication directly from the shell:
claude auth login
claude auth logout
Use Claude Code on Ubuntu
After installation and login, Claude Code behaves like a terminal-native coding assistant instead of a browser chatbot. Start in a project directory, give it a concrete task, and let it inspect files, run commands, and propose edits in context.
Start a Claude Code Session
Launching claude in a repository starts the interactive session most developers use day to day:
cd ~/your-project
claude
Type /help to list built-in commands, or use /init to create a project-level CLAUDE.md file that explains your coding conventions and repository layout.
Use Common Claude Code Commands
These commands cover the first workflows most Ubuntu users need after installation:
| Command | What It Does |
|---|---|
claude | Starts the interactive session in the current project |
claude -p "explain this function" | Runs one non-interactive prompt and exits |
claude -c | Continues the most recent conversation in the current directory |
claude -r | Opens the resume picker or resumes a session when you provide an ID |
/help | Shows available slash commands |
/init | Creates a project CLAUDE.md instructions file |
/config | Opens the interactive settings interface |
/status | Shows version, account, and active configuration sources |
/memory | Edits Claude Code memory files for the current project |
Try Claude Code Prompts
These first prompts map well to everyday Ubuntu development sessions:
claude
> what does this project do?
> where is the main entry point?
> add tests for the authentication helper
When you only need one answer without staying in the interactive session, use print mode:
claude -p "explain the function in src/auth.ts"
claude -c -p "continue with the next failing test"
Configure Claude Code on Ubuntu
Claude Code keeps settings in a small set of JSON files, with separate scopes for your user account and for the repository you are working in. That split matters because personal preferences and team-shared instructions usually do not belong in the same file.
Review Claude Code Settings Files
| Path | Purpose |
|---|---|
~/.claude/settings.json | User-wide settings such as permissions, hooks, environment variables, and model preferences |
.claude/settings.json | Shared project settings stored with the repository |
.claude/settings.local.json | Local project overrides that stay out of source control |
~/.claude.json | Global state such as OAuth session data, theme, and local MCP state |
.mcp.json | Project MCP server configuration |
Open Claude Code Settings
The interactive settings UI is usually faster than hand-editing JSON when you only want to inspect or toggle common options:
/config
/status
Run those slash commands inside an active claude session. /config opens the settings interface, while /status shows which configuration sources are active and whether any of them contain errors.
Set Claude Code Update Preferences
Native installations can follow the latest channel or the delayed stable channel. The same settings file can also disable background auto-updates when you need controlled rollout behavior:
{
"autoUpdatesChannel": "stable",
"minimumVersion": "2.1.100",
"env": {
"DISABLE_AUTOUPDATER": "1"
}
}
Use stable when you want a delayed channel that skips releases with major regressions. Keep latest if you want new Claude Code features as soon as Anthropic publishes them. APT, Homebrew, and npm installs follow their package manager instead of the native background updater.
Update Claude Code on Ubuntu
Update Claude Code with the same toolchain you used for installation. Native, APT, Homebrew, and npm installs do not share update state, so mixing update commands is what usually creates version confusion.
Update Native Claude Code
Native installations update in the background, but you can force an immediate check when you want the newest build right away:
claude update
Update APT Claude Code
APT installations update through Ubuntu’s package manager. Use a single-package upgrade when you only want to refresh Claude Code:
sudo apt update
sudo apt install --only-upgrade claude-code
Update Homebrew Claude Code
Homebrew casks only move when Homebrew updates them, so keep the cask and its cached files tidy in the same pass:
brew upgrade --cask claude-code && brew cleanup claude-code
If you installed the latest cask, replace claude-code with claude-code@latest.
Update npm Claude Code
The npm package follows the usual global package update flow. Run it from the same user account and npm prefix you configured during installation:
npm update -g @anthropic-ai/claude-code
Troubleshoot Claude Code on Ubuntu
Most Ubuntu problems come down to PATH, a missing repository source, network access to Anthropic’s download host, low memory on small servers, search tooling, or authentication from the wrong kind of terminal.
Fix Claude Code Command Not Found
If claude is missing after a successful native or npm install, confirm the user-local launcher exists before you change your shell profile:
ls -l ~/.local/bin/claude
lrwxrwxrwx 1 linuxcapable linuxcapable 54 Apr 28 10:15 /home/linuxcapable/.local/bin/claude -> /home/linuxcapable/.local/share/claude/versions/2.1.x
If that symlink exists, add ~/.local/bin to your shell profile with the rerun-safe command from the native installer section. APT installs place claude under the system path instead, so check the package state if the APT method cannot find the command:
dpkg-query -W claude-code
command -v claude
claude-code 2.1.112-1 /usr/bin/claude
Fix APT Unable to Locate Claude Code
If sudo apt install claude-code returns Unable to locate package, Ubuntu has not ingested Anthropic’s repository yet. Recheck the source file, refresh metadata, and confirm the candidate appears:
cat /etc/apt/sources.list.d/claude-code.sources
sudo apt update
apt-cache policy claude-code
If apt-cache policy still shows no candidate, recreate the keyring and source file from the APT method above. A default Ubuntu install does not know about claude-code until that source is present and apt update succeeds.
Fix Claude Code Installer Download Errors
If the installer returns HTML instead of a shell script, or if curl breaks mid-download, test both the installer endpoint and the current release endpoint:
curl -fsSL https://claude.ai/install.sh -o /dev/null && echo installer-reachable
curl -fsSL https://downloads.claude.ai/claude-code-releases/latest -o /dev/null && echo downloads-reachable
installer-reachable downloads-reachable
If those checks fail, retry from a different network or set HTTP_PROXY and HTTPS_PROXY before running the installer again. TLS errors on minimal systems can also come from missing certificate updates, so refresh ca-certificates before blaming the installer.
sudo apt update
sudo apt install ca-certificates -y
Fix Low-Memory Installs on Ubuntu Server
Small VPS and lab VMs can print Killed during the native install when the Linux OOM killer terminates the process. Claude Code requires at least 4 GB of RAM, so add temporary swap or use a larger instance before retrying.
sudo fallocate -l 2G /swapfile
sudo chmod 600 /swapfile
sudo mkswap /swapfile
sudo swapon /swapfile
After the install succeeds, decide whether that server should keep the swap file permanently. If not, turn it off and remove it:
sudo swapoff /swapfile
sudo rm -f /swapfile
Fix Claude Code Search Issues
Claude Code usually bundles ripgrep, but installing the Ubuntu package gives you a known system copy if search, @file mentions, or discovery features behave oddly:
sudo apt install ripgrep -y
Add the environment override to ~/.claude/settings.json or to the project settings file if you only want the change in one repository:
{
"env": {
"USE_BUILTIN_RIPGREP": "0"
}
}
Run Claude Code Diagnostics
claude doctor checks the installation method, update state, search status, and configuration health. Run it inside a terminal you trust, not inside an arbitrary repository, because it can read local configuration and spawn configured MCP servers for health checks.
claude doctor
Diagnostics Currently running: native (2.1.x) Config install method: native Search: OK (bundled) Updates Auto-updates: enabled Auto-update channel: latest
Fix Claude Code Login Problems
If browser login fails, clear the current session and start the OAuth flow again. On remote Ubuntu hosts, copy the login URL into a browser on your workstation when prompted.
claude auth logout
claude auth login
Remove Claude Code from Ubuntu
Remove Claude Code with the same method you used to install it. Package-manager removals delete the executable first; user settings, OAuth state, MCP files, and project memory stay behind until you remove them separately.
Remove Native Claude Code
Delete the launcher and version directory that the native installer created:
rm -f ~/.local/bin/claude
rm -rf ~/.local/share/claude
Clear the shell cache before checking whether the command is gone:
hash -r
command -v claude || echo command-not-found
command-not-found
Remove APT Claude Code
Remove the package, then delete the source file and keyring the APT method created:
sudo apt remove claude-code -y
sudo rm -f /etc/apt/sources.list.d/claude-code.sources
sudo rm -f /usr/share/keyrings/claude-code.gpg
sudo apt update
Verify the package and command are gone:
hash -r
command -v claude || echo command-not-found
dpkg-query -W claude-code 2>/dev/null || echo package-not-installed
command-not-found package-not-installed
Remove Homebrew Claude Code
Homebrew keeps removal inside its own cask database. If you installed the stable cask, remove it with:
brew uninstall --cask claude-code
If you installed the latest cask instead, remove that cask by name:
brew uninstall --cask claude-code@latest
Remove npm Claude Code
If you installed the npm package, remove it through npm from the same user-local prefix instead of deleting files manually:
npm uninstall -g @anthropic-ai/claude-code
Remove Claude Code Settings
Delete the configuration files only when you want a full reset of your user state and project-specific Claude Code metadata:
Removing these files deletes your Claude Code settings, OAuth session, project memory, MCP configuration, and local session history. Keep them if you only wanted to remove the executable.
rm -rf ~/.claude
rm -f ~/.claude.json
rm -rf .claude
rm -f .mcp.json
Conclusion
Claude Code is now available on Ubuntu through the native installer, Anthropic’s signed APT repository, Homebrew, or npm, with matching update and removal paths. Start in a repository with claude and use /init for project instructions. For adjacent terminal agents, compare with install Codex CLI on Ubuntu. Gemini’s Google-account workflow is covered in install Gemini CLI on Ubuntu.


Formatting tips for your comment
You can use basic HTML to format your comment. Useful tags currently allowed in published comments:
<code>command</code>command<strong>bold</strong><em>italic</em><blockquote>quote</blockquote>