Self-Host OpenClaw on Raspberry Pi
A Raspberry Pi makes an excellent always-on host for OpenClaw. It draws minimal power, runs silently, and sits on your desk or in a closet providing a personal AI coding agent around the clock. Since OpenClaw offloads inference to cloud LLM providers, the Pi only needs to handle orchestration, file I/O, and the gateway server — tasks well within its capabilities.
This guide covers installing OpenClaw on a Raspberry Pi 4 (4GB+) or Pi 5 running Raspberry Pi OS 64-bit, tuning performance, setting up a systemd service for automatic startup, and configuring remote access.
Quick Path
For experienced Pi users:
- Flash Raspberry Pi OS (64-bit) and boot with SSH enabled
- Install OpenClaw:
curl -fsSL https://openclaw.dev/install.sh | sh - Set your API key:
export ANTHROPIC_API_KEY=sk-ant-...and runopenclaw setup - Enable the systemd service:
sudo systemctl enable --now openclaw-gateway - Access via
http://pi-ip:18789or set up Tailscale for remote access
Hardware Requirements
| Component | Minimum | Recommended |
|---|---|---|
| Board | Raspberry Pi 4 (4GB) | Raspberry Pi 5 (8GB) |
| OS | Raspberry Pi OS Lite 64-bit | Raspberry Pi OS Lite 64-bit |
| Storage | 16GB microSD | 32GB+ USB SSD |
| RAM | 4GB | 8GB |
| Network | Wi-Fi or Ethernet | Ethernet (more reliable) |
| Power | Official 5V/3A supply | Official 5V/5A supply (Pi 5) |
A 64-bit operating system is required. OpenClaw does not support 32-bit ARM.
System Preparation
Flash the OS
Download Raspberry Pi OS Lite (64-bit) and flash it to your SD card or USB drive using the Raspberry Pi Imager. In the imager's advanced settings:
- Enable SSH with password authentication or your public key
- Set your username and password
- Configure Wi-Fi if not using Ethernet
- Set the hostname (e.g.,
openclaw-pi)
Boot and Connect
Insert the storage, connect power, and wait 1-2 minutes for the Pi to boot. Then SSH in:
Update the System
Verify 64-bit Architecture
This must output aarch64. If it shows armv7l, you are running a 32-bit OS and need to reflash with the 64-bit image.
Configure Swap
On 4GB models, add swap space to prevent out-of-memory issues during builds and heavy operations:
On 8GB models, the default swap is usually sufficient, but adding 1-2GB does not hurt.
Optimize for Headless Operation
If you are running the Pi without a monitor, reduce the GPU memory allocation to free RAM for OpenClaw:
Reconnect via SSH after the reboot.
Install OpenClaw
Using the Installer Script
The official installer detects your architecture and installs the appropriate binary:
The script installs OpenClaw to ~/.local/bin/openclaw and adds it to your PATH. Verify the installation:
Install Node.js (if needed)
If the installer reports that Node.js is missing or too old:
Initial Configuration
Run the setup wizard:
This creates the configuration directory at ~/.openclaw/ with:
openclaw.json— runtime configurationagents/— agent instruction filesworkspace/— project and session data
Edit the configuration to set your preferred model and gateway options:
Generate and save a gateway token:
Save this token somewhere secure. You will need it to authenticate.
Set Up the systemd Service
Create a systemd unit file so OpenClaw starts automatically on boot and restarts on failure:
Replace your-username with your actual username and set the correct API key.
Enable and start the service:
Check the status:
View logs:
Performance Tips
Use a USB SSD Instead of an SD Card
SD cards are slow for random I/O and wear out faster under heavy write loads. A USB 3.0 SSD dramatically improves performance:
- Flash Raspberry Pi OS to the SSD using the Pi Imager
- Connect the SSD to a USB 3.0 port (blue)
- Update the boot order to prefer USB:
sudo raspi-configand navigate to Advanced Options, then Boot Order
Increase I/O Scheduler Priority
For the OpenClaw service, set an I/O scheduling class:
Monitor Resource Usage
Keep an eye on memory and CPU:
If the Pi is swapping heavily during normal operation, consider upgrading to an 8GB model.
ARM Compatibility Notes
OpenClaw runs natively on ARM64 (aarch64). Most Node.js packages include prebuilt ARM64 binaries. In rare cases, a native module may need to compile from source during installation, which is slower on the Pi but only happens once. If a build fails due to missing development headers:
Network and Remote Access
Local Network Access
From any device on the same network, access the gateway at:
or using the Pi's IP address:
Remote Access with Tailscale
For secure access from anywhere without opening ports on your router, install Tailscale:
After authentication, your Pi joins your tailnet. Access OpenClaw from any device on your tailnet at:
Tailscale handles encryption, NAT traversal, and authentication. No port forwarding or dynamic DNS required.
Remote Access with SSH Tunnel
If you prefer not to install Tailscale, use an SSH tunnel from your local machine:
This requires your Pi to be reachable over SSH (via port forwarding on your router or a reverse tunnel service).
Security Best Practices
- Change the default password. If you did not set a custom password during OS setup, change it immediately:
passwd - Use SSH key authentication. Disable password-based SSH login after setting up keys:
- Keep the gateway on the local network. Do not port-forward 18789 through your router. Use Tailscale or an SSH tunnel instead.
- Enable automatic security updates:
- Protect the API key. Store it in the
.envfile with restrictive permissions:chmod 600 ~/.openclaw/.env - Use a strong gateway token. The
openssl rand -hex 32command generates a 256-bit token that is effectively unguessable.
Troubleshooting
OpenClaw fails to install
Verify you are running a 64-bit OS (uname -m should output aarch64). If you recently flashed the OS, run sudo apt update && sudo apt upgrade -y before installing.
Service fails to start
Check the journal for errors:
Common causes:
- Wrong path to the
openclawbinary in the ExecStart line - Missing or incorrect API key in the environment
- Port 18789 already in use by another service
Out of memory errors
Check current memory usage:
If swap is exhausted, increase the swap size or close other services running on the Pi. On 4GB models, avoid running other memory-intensive applications alongside OpenClaw.
Slow response times
The Pi is not the bottleneck for most operations — the LLM provider's response time dominates. If local operations (file reads, git commands) feel slow:
- Switch from SD card to USB SSD
- Check that swap is not being used heavily (indicates memory pressure)
- Reduce the number of concurrent agent sessions
Network connectivity issues
If the gateway is unreachable from other devices:
SD card corruption
SD cards can corrupt under heavy writes or improper shutdowns. Symptoms include read-only filesystem errors or boot failures. Mitigations:
- Use a USB SSD as your primary boot device
- Always shut down cleanly:
sudo shutdown -h now - Keep regular backups of your
~/.openclaw/directory
Updating OpenClaw
Run the installer again to update to the latest version:
Then restart the service:
Your configuration, agent instructions, and workspace data in ~/.openclaw/ are preserved across updates.