Self-Host OpenClaw on a Mac Mini
Run OpenClaw 24/7 on your own hardware. No cloud bills, no vendor lock-in, full control. This guide walks you through setting up a Mac Mini as a dedicated OpenClaw server with auto-start on boot, remote access, and monitoring.
Estimated time: 20 minutes Difficulty: Beginner Cost: One-time hardware purchase
Prerequisites
Before you begin, make sure you have:
- Mac Mini with Apple Silicon (M1, M2, or M4 recommended). Intel Macs work but run hotter and use more power.
- macOS Sonoma 14.0 or later (macOS Sequoia 15 also works). Check with
sw_vers. - Homebrew installed. If not, the guide covers installation in Step 2.
- An API key for your preferred LLM provider (Anthropic, OpenAI, etc.).
- A stable internet connection. Wired Ethernet is strongly recommended over Wi-Fi for a 24/7 server.
- A keyboard, mouse, and monitor for initial setup (can be removed afterward).
Step 1: Initial Mac Mini Setup
Configure your Mac Mini to stay on and recover gracefully from power events.
Disable Sleep
Open Terminal and run:
# Disable all sleep modes
sudo pmset -a sleep 0 disksleep 0 displaysleep 0
# Automatically restart after a power failure
sudo pmset -a autorestart 1
# Verify your settings
pmset -g
You should see sleep 0, disksleep 0, and autorestart 1 in the output.
Alternatively, go to System Settings > Energy Saver (or Battery on laptops) and set "Turn display off after" to Never.
Enable Automatic Login
This ensures OpenClaw starts without requiring you to type a password after a reboot.
- Open System Settings > Users & Groups.
- Click Automatic Login and select your user account.
- Enter your password to confirm.
Note: Automatic login is disabled if FileVault is turned on. For a headless server, you may choose to disable FileVault, but understand the security trade-off. If you keep FileVault enabled, you will need a keyboard and monitor connected to unlock the disk after every reboot.
Enable SSH (Remote Login)
- Open System Settings > General > Sharing.
- Toggle Remote Login to on.
- Under "Allow access for", select Only these users and add your account (more secure than "All users").
Test it from another machine on the same network:
ssh your-username@your-mac-mini.local
If the .local hostname does not resolve, use the IP address instead. Find it with:
ipconfig getifaddr en0
Step 2: Install Dependencies
Install Homebrew
If Homebrew is not already installed:
/bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/HEAD/install.sh)"
After installation, follow the instructions printed in the terminal to add Homebrew to your PATH. For Apple Silicon Macs, this is typically:
echo 'eval "$(/opt/homebrew/bin/brew shellenv)"' >> ~/.zprofile
eval "$(/opt/homebrew/bin/brew shellenv)"
Install Node.js 20
Option A -- via Homebrew (simpler):
brew install node@20
Option B -- via nvm (recommended if you work with multiple Node versions):
brew install nvm
mkdir ~/.nvm
# Add to your shell profile (~/.zshrc for macOS default shell)
echo 'export NVM_DIR="$HOME/.nvm"' >> ~/.zshrc
echo '[ -s "/opt/homebrew/opt/nvm/nvm.sh" ] && \. "/opt/homebrew/opt/nvm/nvm.sh"' >> ~/.zshrc
source ~/.zshrc
nvm install 20
nvm use 20
nvm alias default 20
Install Git
Git ships with the Xcode Command Line Tools. Install them if you have not already:
xcode-select --install
Verify both tools:
node --version # Should print v20.x.x
git --version # Should print git version 2.x.x
Step 3: Install OpenClaw
Install the CLI
npm install -g openclaw
Verify the installation:
openclaw --version
Configure OpenClaw
Create the configuration directory and file:
mkdir -p ~/.openclaw
Create ~/.openclaw/config with your settings:
cat <<'EOF' > ~/.openclaw/config
{
"agent": {
"name": "mac-mini-agent",
"model": "claude-sonnet-4-20250514",
"maxConcurrentTasks": 2
},
"server": {
"port": 3111,
"host": "0.0.0.0"
},
"logging": {
"level": "info",
"directory": "~/.openclaw/logs"
}
}
EOF
Adjust model, maxConcurrentTasks, and port to your preferences.
Set Up API Keys
Add your API keys to your shell environment. Edit ~/.zshrc:
# OpenClaw API keys
export ANTHROPIC_API_KEY="sk-ant-your-key-here"
# Optional: add other providers
# export OPENAI_API_KEY="sk-your-key-here"
Then reload:
source ~/.zshrc
For the LaunchAgent (Step 4), these environment variables need to be set differently. See the plist configuration below.
Step 4: Auto-Start on Boot
Create a macOS LaunchAgent so OpenClaw starts automatically when your Mac boots up and restarts if it crashes.
Create the LaunchAgent Plist
mkdir -p ~/Library/LaunchAgents
mkdir -p ~/.openclaw/logs
Create the file ~/Library/LaunchAgents/com.openclaw.agent.plist:
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN"
"http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<key>Label</key>
<string>com.openclaw.agent</string>
<key>ProgramArguments</key>
<array>
<string>/opt/homebrew/bin/node</string>
<string>/opt/homebrew/bin/openclaw</string>
<string>start</string>
</array>
<key>RunAtLoad</key>
<true/>
<key>KeepAlive</key>
<true/>
<key>StandardOutPath</key>
<string>/Users/YOUR_USERNAME/.openclaw/logs/openclaw.stdout.log</string>
<key>StandardErrorPath</key>
<string>/Users/YOUR_USERNAME/.openclaw/logs/openclaw.stderr.log</string>
<key>WorkingDirectory</key>
<string>/Users/YOUR_USERNAME</string>
<key>EnvironmentVariables</key>
<dict>
<key>PATH</key>
<string>/opt/homebrew/bin:/usr/local/bin:/usr/bin:/bin</string>
<key>ANTHROPIC_API_KEY</key>
<string>sk-ant-your-key-here</string>
</dict>
<key>ThrottleInterval</key>
<integer>10</integer>
</dict>
</plist>
Important: Replace YOUR_USERNAME with your actual macOS username (run whoami to check). Replace the API key value with your real key.
Why
ThrottleInterval? If OpenClaw crashes immediately on launch, macOS will wait at least 10 seconds before restarting it. This prevents a crash loop from consuming all your system resources.
Load the LaunchAgent
# Load and start the service
launchctl load ~/Library/LaunchAgents/com.openclaw.agent.plist
# Verify it is running
launchctl list | grep openclaw
You should see a line with com.openclaw.agent and a PID (process ID) number. If the first column shows 0, it is running. A non-zero number indicates an exit code (something went wrong -- see Troubleshooting).
Manage the Service
# Stop the service
launchctl unload ~/Library/LaunchAgents/com.openclaw.agent.plist
# Restart (unload then load)
launchctl unload ~/Library/LaunchAgents/com.openclaw.agent.plist
launchctl load ~/Library/LaunchAgents/com.openclaw.agent.plist
# On macOS Ventura+ you can also use:
launchctl kickstart -k gui/$(id -u)/com.openclaw.agent
Step 5: Remote Access
Once the Mac Mini is running headless (no monitor), you need a way to manage it remotely.
SSH (Same Network)
From any machine on the same local network:
ssh your-username@your-mac-mini.local
From there you can check logs, restart services, and update OpenClaw.
Tailscale VPN (Recommended for Remote Access)
Tailscale creates a secure, zero-config mesh VPN so you can reach your Mac Mini from anywhere -- your laptop at a coffee shop, your phone, another server.
brew install --cask tailscale
- Open the Tailscale app and sign in.
- Enable Tailscale on your Mac Mini and on any device you want to connect from.
- SSH into your Mac Mini using its Tailscale IP or hostname:
ssh your-username@your-mac-mini-hostname
Tailscale is free for personal use (up to 100 devices). No port forwarding, no dynamic DNS, no firewall configuration required.
WireGuard (Alternative)
If you prefer to self-host your VPN:
brew install wireguard-tools
WireGuard requires more manual configuration (key generation, endpoint setup, port forwarding on your router) but gives you full control with no third-party dependency.
Screen Sharing (Optional)
For a full GUI remotely:
- On the Mac Mini: System Settings > General > Sharing > Screen Sharing -- toggle on.
- From another Mac: Open Finder > Go > Connect to Server and enter
vnc://your-mac-mini.local. - Or use the built-in Screen Sharing app.
Screen sharing works well over Tailscale too, for occasional GUI tasks.
Step 6: Monitoring
Check If OpenClaw Is Running
# Quick status check
launchctl list | grep openclaw
# More detail: find the process
pgrep -fl openclaw
# View recent logs
tail -100 ~/.openclaw/logs/openclaw.stdout.log
tail -100 ~/.openclaw/logs/openclaw.stderr.log
Set Up a Health Check Alert
Create a script at ~/.openclaw/health-check.sh:
#!/bin/bash
SERVICE="com.openclaw.agent"
LOG_FILE="$HOME/.openclaw/logs/health-check.log"
if ! launchctl list | grep -q "$SERVICE"; then
echo "$(date): OpenClaw is NOT running. Attempting restart..." >> "$LOG_FILE"
launchctl load ~/Library/LaunchAgents/com.openclaw.agent.plist
# Optional: send a notification
osascript -e 'display notification "OpenClaw was down and has been restarted." with title "OpenClaw Health Check"'
else
echo "$(date): OpenClaw is running." >> "$LOG_FILE"
fi
Make it executable and schedule it with cron:
chmod +x ~/.openclaw/health-check.sh
# Run every 5 minutes
crontab -e
Add this line:
*/5 * * * * /bin/bash ~/.openclaw/health-check.sh
Log Rotation
Prevent log files from consuming all your disk space. Create ~/.openclaw/rotate-logs.sh:
#!/bin/bash
LOG_DIR="$HOME/.openclaw/logs"
MAX_SIZE=52428800 # 50 MB in bytes
for log_file in "$LOG_DIR"/*.log; do
if [ -f "$log_file" ]; then
file_size=$(stat -f%z "$log_file" 2>/dev/null || echo 0)
if [ "$file_size" -gt "$MAX_SIZE" ]; then
mv "$log_file" "${log_file}.old"
touch "$log_file"
echo "$(date): Rotated $log_file" >> "$LOG_DIR/rotation.log"
fi
fi
done
chmod +x ~/.openclaw/rotate-logs.sh
# Add to crontab: run daily at 3 AM
crontab -e
0 3 * * * /bin/bash ~/.openclaw/rotate-logs.sh
Step 7: Automatic Updates
Create an update script at ~/.openclaw/update.sh:
#!/bin/bash
LOG_FILE="$HOME/.openclaw/logs/update.log"
echo "$(date): Checking for OpenClaw updates..." >> "$LOG_FILE"
# Capture the current version
CURRENT_VERSION=$(openclaw --version 2>/dev/null)
# Update OpenClaw
npm update -g openclaw >> "$LOG_FILE" 2>&1
# Capture the new version
NEW_VERSION=$(openclaw --version 2>/dev/null)
if [ "$CURRENT_VERSION" != "$NEW_VERSION" ]; then
echo "$(date): Updated from $CURRENT_VERSION to $NEW_VERSION. Restarting..." >> "$LOG_FILE"
launchctl kickstart -k gui/$(id -u)/com.openclaw.agent
echo "$(date): Restart complete." >> "$LOG_FILE"
else
echo "$(date): Already on latest version ($CURRENT_VERSION). No restart needed." >> "$LOG_FILE"
fi
chmod +x ~/.openclaw/update.sh
# Add to crontab: check for updates weekly on Sunday at 4 AM
crontab -e
0 4 * * 0 /bin/bash ~/.openclaw/update.sh
Tip: If you prefer manual control over updates, skip the cron job and run
~/.openclaw/update.shby hand when you are ready.
Hardware Recommendations
| Configuration | Mac Mini Model | RAM | Best For | Price (approx.) |
|---|---|---|---|---|
| Budget | M1 (refurbished) | 8 GB | Single agent, light workloads | $350-400 |
| Recommended | M2 | 8 GB | Single agent, moderate workloads | $499-599 |
| Multi-agent | M2 / M4 | 16 GB | Multiple concurrent agents | $599-799 |
| Heavy workload | M4 Pro | 24 GB | Many agents, local model inference | $1,399+ |
For most users, the Mac Mini M2 base model with 8 GB RAM is plenty. OpenClaw itself uses minimal memory -- the bulk of computation happens on the LLM provider's servers. You only need more RAM if you are running multiple agents simultaneously or hosting local models alongside OpenClaw.
Additional considerations:
- Storage: The built-in 256 GB SSD is sufficient. An external SSD is only needed if you store large datasets or extensive logs.
- Power consumption: A Mac Mini M2 idles at approximately 5-7 watts. Running 24/7 costs roughly $5-10 per year in electricity.
- Ethernet: Use the built-in Gigabit Ethernet port rather than Wi-Fi for reliability.
- UPS: A small uninterruptible power supply ($40-80) protects against brief power outages and gives the Mac Mini time to shut down cleanly during longer ones.
Troubleshooting
OpenClaw Does Not Start After Reboot
Check the LaunchAgent is loaded:
launchctl list | grep openclaw
If it does not appear, load it manually:
launchctl load ~/Library/LaunchAgents/com.openclaw.agent.plist
If it appears with a non-zero exit code, check the error logs:
cat ~/.openclaw/logs/openclaw.stderr.log
launchctl Reports Error Code 78
Error 78 means the plist file has a syntax or configuration error. Validate it:
plutil -lint ~/Library/LaunchAgents/com.openclaw.agent.plist
Common causes: missing closing tags, incorrect file paths, invalid XML characters.
Permission Denied Errors
If logs show permission errors related to API keys or config files:
# Fix ownership
chmod 600 ~/.openclaw/config
chmod 700 ~/.openclaw
ls -la ~/.openclaw/
Make sure the plist EnvironmentVariables section contains your API key. LaunchAgents do not inherit your shell environment, so keys in ~/.zshrc alone are not enough.
Node.js Not Found by LaunchAgent
The LaunchAgent uses absolute paths. If you installed Node via nvm instead of Homebrew, the path in the plist will be different:
# Find your node path
which node
# Typical nvm path: /Users/YOUR_USERNAME/.nvm/versions/node/v20.x.x/bin/node
# Find your openclaw path
which openclaw
Update the ProgramArguments in the plist to match these paths exactly.
High CPU or Memory Usage
# Check OpenClaw resource usage
top -l 1 | grep -i openclaw
# Or use Activity Monitor via Screen Sharing
If resource usage is unexpectedly high, check maxConcurrentTasks in ~/.openclaw/config and reduce it. Two concurrent tasks is a safe default for 8 GB machines.
Mac Mini Goes to Sleep Despite pmset Settings
Verify your settings actually took effect:
pmset -g
If sleep is not 0, your settings may have been overridden by a macOS update. Re-run:
sudo pmset -a sleep 0 disksleep 0 displaysleep 0
Also check System Settings > Lock Screen and set "Start Screen Saver when inactive" to Never.
Summary
After completing this guide, your Mac Mini will:
- Run OpenClaw automatically on every boot
- Restart the agent if it crashes
- Be accessible remotely via SSH (and optionally Tailscale)
- Alert you if the service goes down
- Rotate logs to prevent disk bloat
- Check for and apply updates on a weekly schedule
Total recurring cost: your internet bill and roughly $5-10/year in electricity. No cloud subscriptions required.