Fix Claude Code Install Killed on Linux

Written by Michael Lip · Solo founder of Zovo · $400K+ on Upwork · 100% JSS Join 50+ builders · More at zovo.one

The Error

During Claude Code installation on a Linux VPS or cloud instance, the process is terminated:

Setting up Claude Code...
Installing Claude Code native build latest...
bash: line 142: 34803 Killed    "$binary_path" install ${TARGET:+"$TARGET"}

Quick Fix

Add swap space and retry the installation:

sudo fallocate -l 2G /swapfile
sudo chmod 600 /swapfile
sudo mkswap /swapfile
sudo swapon /swapfile
curl -fsSL https://claude.ai/install.sh | bash

What’s Happening

The Linux OOM (Out of Memory) killer terminated the Claude Code installation process because the system ran out of physical memory. Claude Code requires at least 4 GB of available RAM for the installation and setup phase.

Many VPS and cloud instances ship with 1-2 GB of RAM and no swap space. When the installer extracts and configures the binary, memory usage spikes. Without swap as an overflow, the kernel kills the most memory-hungry process to prevent a system crash.

The Killed message with no additional error context is the telltale sign of the OOM killer. You can confirm this by checking the kernel log:

dmesg | grep -i "oom\|killed"

Step-by-Step Fix

Step 1: Check available memory

free -h

Look at the “available” column. If it is under 4 GB and swap shows 0, this is the cause.

Step 2: Check for existing swap

swapon --show

If there is no output, no swap is configured.

Step 3: Create a swap file

Create a 2 GB swap file:

sudo fallocate -l 2G /swapfile
sudo chmod 600 /swapfile
sudo mkswap /swapfile
sudo swapon /swapfile

Verify swap is active:

free -h

You should now see swap space in the output.

Step 4: Retry the installation

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

Step 5: Make swap permanent (optional)

If you want the swap file to persist across reboots:

echo '/swapfile none swap sw 0 0' | sudo tee -a /etc/fstab

Step 6: Docker-specific fix

When installing Claude Code in a Docker container, the issue is compounded if the container runs as root with / as the working directory. The installer scans the filesystem and excessive memory usage follows.

Set a working directory before installing:

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

Increase Docker memory limits if using Docker Desktop:

docker build --memory=4g .

Prevention

Before installing Claude Code on any Linux server, verify memory availability:

free -h

If available memory is under 4 GB, add swap first. For production servers running Claude Code, allocate at least 4 GB of RAM. Close unnecessary processes before installation to free memory.

For automated provisioning, include swap setup in your cloud-init or Terraform configuration:

#!/bin/bash
fallocate -l 2G /swapfile
chmod 600 /swapfile
mkswap /swapfile
swapon /swapfile
echo '/swapfile none swap sw 0 0' >> /etc/fstab
curl -fsSL https://claude.ai/install.sh | bash

Level Up Your Claude Code Workflow

The developers who get the most out of Claude Code aren’t just fixing errors — they’re running multi-agent pipelines, using battle-tested CLAUDE.md templates, and shipping with production-grade operating principles.

Get Claude Code Mastery — included in Zovo Lifetime →

16 CLAUDE.md templates · 80+ prompts · orchestration configs · workflow playbooks. $99 once, free forever.