Browse guides
Back to Guides
BeginnerGetting StartedOpenClaw

OpenClaw on Raspberry Pi

Turn a Raspberry Pi 4 or Pi 5 into a dedicated OpenClaw home server: OS setup, Node.js ARM installation, performance tuning, heat management, and running 24/7.

Sam Okafor35 minutes

#Why Raspberry Pi?

A Raspberry Pi makes a surprisingly capable always-on OpenClaw server. It's cheap, silent, uses minimal power (5-15W), and sits on your desk or closet shelf running 24/7. Your data stays local, and there are no monthly server bills.

Recommended: Raspberry Pi 5 (4GB+ RAM) or Pi 4 (4GB+ RAM). The Pi 4 with 2GB works but you'll want swap enabled. Pi 3 and older are not recommended — Node.js performance is too limited.

#What You Need

ItemNotes
Raspberry Pi 4 or 54GB RAM recommended (8GB is overkill for OpenClaw)
MicroSD card32GB+ Class 10 / A2 rated
Power supplyOfficial USB-C PSU (5V/3A for Pi 4, 5V/5A for Pi 5)
Ethernet cableRecommended over WiFi for reliability
Case with fanEssential for 24/7 operation — Pi 5 runs hot
Keyboard/monitorOnly for initial setup (headless after that)

#Step 1: Flash Raspberry Pi OS

  1. Download Raspberry Pi Imager on your computer
  2. Insert your MicroSD card
  3. Open Raspberry Pi Imager:
    • OS: Raspberry Pi OS Lite (64-bit) — no desktop needed for a server
    • Storage: Your MicroSD card
    • Settings (gear icon):
      • Enable SSH
      • Set username: openclaw
      • Set password
      • Configure WiFi (optional, Ethernet preferred)
      • Set timezone
  4. Click Write and wait for it to finish

Use the 64-bit (arm64) version of Raspberry Pi OS, not the 32-bit. Node.js and OpenClaw perform significantly better on 64-bit.


#Step 2: First Boot and SSH

  1. Insert the MicroSD card into your Pi
  2. Connect Ethernet and power
  3. Wait 1-2 minutes for boot
bash
# Find your Pi's IP (from your computer)
# Option 1: Check your router's DHCP client list
# Option 2: Use mDNS
ping raspberrypi.local
# SSH in
ssh openclaw@raspberrypi.local
# Or: ssh openclaw@192.168.x.x

#Initial System Setup

bash
# Update everything
sudo apt update && sudo apt full-upgrade -y
# Set a static hostname
sudo hostnamectl set-hostname openclaw-pi
# Expand filesystem (if not auto-expanded)
sudo raspi-config --expand-rootfs
# Reboot to apply changes
sudo reboot

#Step 3: Optimize for 24/7 Operation

#Reduce SD Card Wear

SD cards have limited write cycles. Minimize unnecessary writes:

bash
# Reduce swap writes
echo 'vm.swappiness=10' | sudo tee -a /etc/sysctl.conf
# Disable swap if you have 4GB+ RAM (optional)
# sudo dphys-swapconfig swapoff
# sudo systemctl disable dphys-swapfile
# Or increase swap for 2GB Pi models
sudo nano /etc/dphys-swapfile
# Set CONF_SWAPSIZE=2048
sudo systemctl restart dphys-swapfile
# Move logs to tmpfs (RAM)
echo 'tmpfs /var/log tmpfs defaults,noatime,nosuid,mode=0755,size=50m 0 0' | sudo tee -a /etc/fstab

For maximum SD card longevity, consider booting from a USB SSD instead of MicroSD. Both Pi 4 and Pi 5 support USB boot natively.

#Thermal Management

bash
# Check temperature
vcgencmd measure_temp
# Install monitoring
sudo apt install -y lm-sensors
# Target: under 70°C under load
# If consistently over 80°C, improve cooling

Cooling recommendations:

  • Pi 5: Active cooling is essential — use the official active cooler or a case with fan
  • Pi 4: A heatsink + fan case is strongly recommended for 24/7 use
  • Passive cooling alone is not recommended for always-on operation

#Step 4: Install Node.js (ARM64)

bash
# Install Node.js 22 LTS
curl -fsSL https://deb.nodesource.com/setup_22.x | sudo -E bash -
sudo apt-get install -y nodejs
# Verify
node --version # v22.x.x
npm --version
# Also install build tools (needed by some npm packages)
sudo apt install -y build-essential

#Step 5: Install OpenClaw

bash
# Install globally
npm install -g openclaw
# Run setup
openclaw setup

#Step 6: systemd Service

bash
sudo nano /etc/systemd/system/openclaw.service
ini
[Unit]
Description=OpenClaw AI Agent
After=network-online.target
Wants=network-online.target
[Service]
Type=simple
User=openclaw
WorkingDirectory=/home/openclaw/.openclaw/workspace
ExecStart=/usr/bin/openclaw gateway start --foreground
Restart=always
RestartSec=15
StandardOutput=journal
StandardError=journal
Environment=NODE_ENV=production
# Limit memory to prevent OOM on low-RAM Pis
MemoryMax=512M
[Install]
WantedBy=multi-user.target
bash
sudo systemctl daemon-reload
sudo systemctl enable openclaw
sudo systemctl start openclaw
sudo systemctl status openclaw

#Performance Tips

#Pi 5 vs Pi 4

MetricPi 4 (4GB)Pi 5 (4GB)
Node.js startup~3s~1.5s
Agent response overhead~100ms~50ms
RAM available for OpenClaw~3 GB~3.5 GB
Power consumption~5-7W~7-12W
Overall feelCapableSnappy

#Memory Optimization

bash
# Check memory usage
free -h
# Disable unnecessary services
sudo systemctl disable bluetooth
sudo systemctl disable avahi-daemon
sudo systemctl disable triggerhappy
# On Pi OS Lite, most services are already minimal

#Accessing Remotely

#From Your Local Network

bash
ssh openclaw@openclaw-pi.local

#From Outside Your Network

Options:

  1. Tailscale (recommended) — Zero-config VPN
    bash
    curl -fsSL https://tailscale.com/install.sh | sh
    sudo tailscale up
  2. Port forwarding — Less secure, configure on your router
  3. Cloudflare Tunnel — Free, no port forwarding needed

#Troubleshooting

#Pi Won't Boot

  • Try a different MicroSD card
  • Re-flash with Raspberry Pi Imager
  • Check power supply — underpowered PSU causes random crashes

#Slow Performance

  • Check temperature: vcgencmd measure_temp
  • Check if throttled: vcgencmd get_throttled (0x0 = no throttling)
  • Add swap if RAM is low: check with free -h

#Network Drops

  • Use Ethernet over WiFi for 24/7 operation
  • If WiFi required, disable power management:
    bash
    sudo iw wlan0 set power_save off

#Next Steps

Skip the trial and error

ClawDocx members get 500+ tested prompts, ready-to-install SKILL.md files, SOUL.md and CLAUDE.md templates, and an MCP server so your agent can pull all of it directly while it works.