Install OpenClaw on Raspberry Pi for Always-On Self-Hosting
Learn how to run a continuously operating OpenClaw Gateway on a Raspberry Pi. This guide covers hardware compatibility, prerequisites, and setup for low-cost, always-on self-hosting.
Read this when
- Setting up OpenClaw on a Raspberry Pi
- Running OpenClaw on ARM devices
- Building a cheap always-on personal AI
Run a continuously operating OpenClaw Gateway on a Raspberry Pi that stays active at all times. Because the Pi functions solely as the gateway (model execution occurs in the cloud through an API), even a low-end Pi can manage the load without issue. Typical hardware expenses are a one-time cost of $35 to $80, with no recurring monthly charges.
Hardware compatibility
| Pi model | RAM | Works? | Notes |
|---|---|---|---|
| Pi 5 | 4/8 GB | Best | Fastest, recommended. |
| Pi 4 | 4 GB | Good | Sweet spot for most users. |
| Pi 4 | 2 GB | OK | Add swap. |
| Pi 4 | 1 GB | Tight | Possible with swap, minimal config. |
| Pi 3B+ | 1 GB | Slow | Works but sluggish. |
| Pi Zero 2 W | 512 MB | No | Not recommended. |
Minimum: 1 GB RAM, 1 core, 500 MB free disk, 64-bit OS. Recommended: 2 GB+ RAM, 16 GB+ SD card (or USB SSD), Ethernet.
Prerequisites
- Raspberry Pi 4 or 5 with 2 GB+ RAM (4 GB recommended)
- MicroSD card (16 GB+) or USB SSD (better performance)
- Official Pi power supply
- Network connection (Ethernet or WiFi)
- 64-bit Raspberry Pi OS (required -- do not use 32-bit)
- About 30 minutes
Setup
Flash the OS
Use Raspberry Pi OS Lite (64-bit) -- no desktop needed for a headless server.
- Download Raspberry Pi Imager.
- Choose OS: Raspberry Pi OS Lite (64-bit).
- In the settings dialog, pre-configure:
- Hostname:
gateway-host - Enable SSH
- Set username and password
- Configure WiFi (if not using Ethernet)
- Hostname:
- Flash to your SD card or USB drive, insert it, and boot the Pi.
Connect via SSH
ssh user@gateway-host
Update the system
sudo apt update && sudo apt upgrade -y
sudo apt install -y git curl build-essential
# Set timezone (important for cron and reminders)
sudo timedatectl set-timezone America/Chicago
Install Node.js 24
curl -fsSL https://deb.nodesource.com/setup_24.x | sudo -E bash -
sudo apt install -y nodejs
node --version
Add swap (important for 2 GB or less)
sudo fallocate -l 2G /swapfile
sudo chmod 600 /swapfile
sudo mkswap /swapfile
sudo swapon /swapfile
echo '/swapfile none swap sw 0 0' | sudo tee -a /etc/fstab
# Reduce swappiness for low-RAM devices
echo 'vm.swappiness=10' | sudo tee -a /etc/sysctl.conf
sudo sysctl -p
Install OpenClaw
curl -fsSL https://openclaw.ai/install.sh | bash
Run onboarding
openclaw onboard --install-daemon
Work through the setup assistant. For headless devices, API keys are recommended over OAuth. The Telegram channel is the simplest one to begin with.
Verify
openclaw status
systemctl --user status openclaw-gateway.service
journalctl --user -u openclaw-gateway.service -f
Access the Control UI
From your local machine, retrieve a dashboard URL from the Pi:
ssh user@gateway-host 'openclaw dashboard --no-open'
Then, in a separate terminal, establish an SSH tunnel:
ssh -N -L 18789:127.0.0.1:18789 user@gateway-host
Open the printed URL in a browser on your local machine. For permanent remote access, refer to the Tailscale integration.
Performance tips
Use a USB SSD -- SD cards are slow and have limited write endurance. A USB SSD offers significantly better performance and can handle many more write cycles; use it for OPENCLAW_STATE_DIR if the OS stays on the SD card. Consult the Pi USB boot guide.
Enable module compile cache -- This speeds up repeated CLI invocations on lower-power Pi systems. OPENCLAW_NO_RESPAWN=1 keeps routine Gateway restarts running in-process, which avoids extra process handoffs and keeps PID tracking simple on smaller hosts:
grep -q 'NODE_COMPILE_CACHE=/var/tmp/openclaw-compile-cache' ~/.bashrc || cat >> ~/.bashrc <<'EOF' # pragma: allowlist secret
export NODE_COMPILE_CACHE=/var/tmp/openclaw-compile-cache
mkdir -p /var/tmp/openclaw-compile-cache
export OPENCLAW_NO_RESPAWN=1
EOF
source ~/.bashrc
Use /var/tmp, not /tmp -- some distributions clear /tmp at boot time, which drops the warmed cache.
Reduce memory usage -- For headless configurations, free up GPU memory and disable unnecessary services:
echo 'gpu_mem=16' | sudo tee -a /boot/config.txt
sudo systemctl disable bluetooth
systemd drop-in for stable restarts -- If this Pi primarily runs OpenClaw, add a service drop-in:
systemctl --user edit openclaw-gateway.service
[Service]
Environment=OPENCLAW_NO_RESPAWN=1
Environment=NODE_COMPILE_CACHE=/var/tmp/openclaw-compile-cache
Restart=always
RestartSec=2
TimeoutStartSec=90
Then run systemctl --user daemon-reload && systemctl --user restart openclaw-gateway.service. On a headless Pi, also enable lingering so the user service persists after logout: sudo loginctl enable-linger "$(whoami)".
Recommended model setup
Since the Pi only runs the gateway, use cloud-hosted API models -- do not run local LLMs on a Pi, as even small models are too slow to be useful:
{
"agents": {
"defaults": {
"model": {
"primary": "anthropic/claude-sonnet-4-6",
"fallbacks": ["openai/gpt-5.4-mini"]
}
}
}
}
ARM binary notes
Most OpenClaw features work on ARM64 without modifications (Node.js, Telegram, WhatsApp/Baileys, Chromium). The binaries that sometimes lack ARM builds are typically optional Go or Rust CLI tools shipped by skills. Check the architecture with uname -m (it should return aarch64), then look at a missing binary's release page for linux-arm64 or aarch64 artifacts before falling back to building from source.
Persistence and backups
OpenClaw state is stored in:
~/.openclaw/--openclaw.json, per-agentauth-profiles.json, channel/provider state, sessions.~/.openclaw/workspace/-- agent workspace (SOUL.md, memory, artifacts).
These directories persist across reboots and benefit from an SSD over an SD card for both performance and longevity. Create a portable snapshot with:
openclaw backup create
Troubleshooting
Out of memory -- Confirm swap is active by running free -h. Turn off unused services (sudo systemctl disable cups bluetooth avahi-daemon). Only use API-based models.
Slow performance -- Replace the SD card with a USB SSD. Check for CPU throttling using vcgencmd get_throttled (it should show 0x0).
Service will not start -- Review logs with journalctl --user -u openclaw-gateway.service --no-pager -n 100 and execute openclaw doctor --non-interactive. For a headless Pi, also verify that lingering is enabled: sudo loginctl enable-linger "$(whoami)".
ARM binary issues -- If a skill fails with "exec format error", verify whether the binary provides an ARM64 build. Confirm the architecture with uname -m (it should display aarch64).
WiFi disconnections -- Turn off WiFi power saving: sudo iwconfig wlan0 power off.
Next steps
- Channels -- link Telegram, WhatsApp, Discord, and other services
- Gateway configuration -- every available configuration setting
- Updating -- maintain the latest version of OpenClaw