Running OpenClaw on a Headless Mac (My Pi 4 Wasn't Cutting It)

 · 8 min read  ·

I was running OpenClaw on a Raspberry Pi 4 with 4GB of RAM.

It worked…barely.

QMD’s semantic search OOM’d every time, memory_search was limited to basic keyword matching, and anything that needed real processing power made the whole thing crawl.

Then I remembered something: I had an M1 MacBook Pro sitting in a closet. The display was completely dead. I had taken it to a repair shop and they wanted $1,200 to fix the screen. No thanks.

But you know what a laptop with a broken screen is perfect for? A headless server.

There’s 16GB of RAM. Apple Silicon. No display needed. It’s been running OpenClaw 24/7 for about a week now and I’m not going back.

Here’s how I set it up and what tripped me up along the way.

Why not just use a VPS?

You absolutely can run OpenClaw on a VPS. But:

  • A decent VPS with enough RAM costs $20-40/month
  • You’re adding latency to every tool call
  • You’re trusting a third party with your API keys and personal data
  • A broken Mac sitting in your closet costs $0/month

If you’ve got an old Mac laying around, it’s probably the best OpenClaw server you’ll find for free.

What you need

  • A Mac you don’t use as a daily driver (broken screen, old model, whatever)
  • An Ethernet cable. Wi-Fi works but Ethernet is more reliable for something that needs to stay connected
  • A power adapter, because it needs to stay plugged in 24/7
  • Another computer to SSH into it, or a monitor + keyboard for the initial setup
  • Node.js 22+ installed

If the display works, you’ll do the initial setup directly. If it’s broken like mine, you have a couple of options:

  1. Use RustDesk for remote desktop access (this is what I do. No monitor needed)
  2. Hook up an external monitor temporarily for the initial setup

I use RustDesk to get full GUI control over the Mac without ever plugging in a monitor. SSH handles the day-to-day terminal stuff. Between the two, I never need physical access.

But initially, it would be a good idea to hook up the peripherals.

Step 1: prevent sleep (critical)

This tripped me up at first. macOS loves to sleep, and a sleeping Mac means a dead OpenClaw server.

Open Terminal (directly or via SSH) and run:

# Prevent system sleep entirely
sudo pmset -a sleep 0

# Prevent disk sleep
sudo pmset -a disksleep 0

# Keep network alive during sleep (just in case)
sudo pmset -a tcpkeepalive 1

# Wake on network access (for Wake-on-LAN)
sudo pmset -a womp 1

# Disable Power Nap (it wakes the system at random times)
sudo pmset -a powernap 0

The key one is sleep 0. This tells macOS to never sleep the system, even with the lid closed. As long as it’s plugged in, you’re good. No dummy HDMI plug, no hacks.

Verify your settings:

pmset -g

You should see sleep 0 and SleepDisabled 1.

Note: You can also set display sleep separately with sudo pmset -a displaysleep 0, but there’s no point if the display is broken anyway. I leave mine at 10 minutes. The display is dead, so who cares.

Step 2: enable SSH

If SSH isn’t already enabled:

# Enable Remote Login
sudo systemsetup -setremotelogin on

Or go to System Settings → General → Sharing → Remote Login and toggle it on.

Test it from another machine:

ssh yourusername@your-mac-ip

Find your Mac’s IP with:

ipconfig getifaddr en0   # Ethernet
# or
ipconfig getifaddr en1   # Wi-Fi (if using Wi-Fi)

Tip: Set a static IP on your router for this Mac so the address doesn’t change. Or use the .local hostname: ssh [email protected]

Step 3: use Ethernet

Wi-Fi works, but I wouldn’t trust it for something that needs to stay online. Ethernet doesn’t drop when your router hiccups or someone microwaves popcorn.

Just plug it in. macOS picks it up automatically. Verify:

networksetup -getinfo "Ethernet"

If you see an IP address, you’re good. Some Macs (especially newer MacBooks) only have USB-C, so you might need a USB-C to Ethernet adapter.

To make sure macOS always prefers Ethernet over Wi-Fi, set the network service order:

sudo networksetup -ordernetworkservices "Ethernet" "Wi-Fi" "Thunderbolt Bridge"

macOS will use Ethernet whenever it’s connected and fall back to Wi-Fi if the cable gets unplugged. Check the current order anytime with networksetup -listnetworkserviceorder.

Step 4: enable auto-login and auto-restart

If the power goes out, you want the Mac to come back up on its own:

# Restart automatically after power failure
sudo pmset -a autorestart 1

# Restart on freeze
sudo systemsetup -setrestartfreeze on

For auto-login (so you don’t need to type a password after reboot):

Go to System Settings → Users & Groups → Automatic Login and select your user.

⚠️ If you have FileVault enabled, auto-login won’t work. You’ll need to disable FileVault or accept that you’ll need to manually unlock after a reboot. For a server sitting in your house, I’d disable FileVault.

Step 5: install OpenClaw

If you haven’t already:

# Install Node.js (if not installed)
# Download from https://nodejs.org or use nvm/fnm

# Script that works anywhere
curl -fsSL https://openclaw.ai/install.sh | bash

# or 

# Install OpenClaw
npm install -g openclaw

# Run the setup wizard
openclaw setup

Follow the prompts. It’ll ask for your Claude API key, set up the config, and create the workspace.

Step 6: set up the LaunchAgent (auto-start on boot)

You don’t want to SSH in and manually start OpenClaw every time the Mac reboots. launchd handles this.

# Let OpenClaw create the service file for you
openclaw doctor --repair

This creates a launchd plist at ~/Library/LaunchAgents/ai.openclaw.gateway.plist and configures it to start on boot.

Verify it’s running:

openclaw gateway status

You should see RPC probe: ok.

If you need to manually manage it:

# Stop
launchctl unload ~/Library/LaunchAgents/ai.openclaw.gateway.plist

# Start
launchctl load ~/Library/LaunchAgents/ai.openclaw.gateway.plist

# Restart (stop then start)
launchctl unload ~/Library/LaunchAgents/ai.openclaw.gateway.plist && launchctl load ~/Library/LaunchAgents/ai.openclaw.gateway.plist

Gotchas I hit

Permission Issues

macOS really wants you to click “Allow” on things. Full Disk Access, Accessibility, network permissions for new binaries. All of these pop up as GUI dialogs.

If your screen is broken, that’s a problem. But you don’t actually need a physical monitor.

I use RustDesk. It’s a free, open-source remote desktop app. Install it on the Mac server, and it walks you through granting all the macOS permissions (Screen Recording, Accessibility, Input Monitoring). Once those are approved, you can control the Mac from any other computer.

Go to Settings → Network and check “Enable Direct IP Access” so you can connect by IP address instead of remembering a code. Set a password, and you’re done. Full GUI control of your headless Mac from anywhere on your network.

The PATH Problem

This one got me. launchd services don’t inherit your shell’s PATH. So if you install tools via Homebrew (/opt/homebrew/bin) or in custom locations (~/bin), the OpenClaw gateway just… can’t find them. Skills fail silently.

Run openclaw doctor --repair and it usually sorts this out. If not, manually edit the plist:

nano ~/Library/LaunchAgents/ai.openclaw.gateway.plist

Find the PATH entry and add your custom directories:

<key>PATH</key>
<string>/Users/yourname/bin:/opt/homebrew/bin:/usr/local/bin:/usr/bin:/bin</string>

Then reload the service.

Port Mismatches

If you change the gateway port in openclaw.json, the plist might still reference the old port. This causes a mismatch where the CLI can’t connect to the running gateway.

Fix: Run openclaw doctor --repair to sync the plist with your config.

Clamshell Mode and Bluetooth Keyboards

If you have a Bluetooth keyboard paired with the Mac, clamshell mode sometimes gets confused. The Mac might sleep when you close the lid because it “loses” the Bluetooth keyboard.

Fix: If you’re using this purely as a headless server, unpair any Bluetooth devices. You don’t need them.

The before and after

Raspberry Pi 4 (4GB RAM):

  • QMD semantic search: ❌ OOM killed every time
  • memory_search: keyword-only (BM25)
  • Response times: slow, especially with tool calls
  • Multi-agent: forget about it
  • Cost: ~$80 for the Pi + accessories

M1 MacBook Pro (16GB RAM):

  • QMD semantic search: ✅ works perfectly
  • memory_search: full semantic + keyword search
  • Response times: fast, even with multiple tools running
  • Multi-agent: handles concurrent sub-agents easily
  • Cost: $0 (already owned, broken screen)

The RAM alone was worth the move. But the M1 chip just makes everything faster. Tool calls, file operations, even brew install doesn’t feel like waiting anymore.

Other Macs that work

You don’t need a MacBook Pro. A Mac Mini, MacBook Air, even an old iMac would all work. Intel Macs are fine too, just noticeably slower than M1+.

Quick reference: all the commands

# Prevent sleep
sudo pmset -a sleep 0
sudo pmset -a disksleep 0
sudo pmset -a tcpkeepalive 1
sudo pmset -a womp 1
sudo pmset -a autorestart 1

# Enable SSH
sudo systemsetup -setremotelogin on

# Install OpenClaw
npm install -g openclaw
openclaw setup

# Set up auto-start
openclaw doctor --repair

# Check status
openclaw gateway status

# View logs
tail -f ~/.openclaw/logs/gateway.log

Is it worth it?

If you’ve got a Mac collecting dust, don’t sell it for parts. Plug it into Ethernet, run the commands above, and you’ve got an OpenClaw server that beats most VPS setups, for free.

The migration took me about an hour. Semantic search works, sub-agents run in parallel, and I haven’t had an OOM kill since.

Check your closet. You might be sitting on a server you’ve forgotten about.

This page may contain affiliate links. Please see my affiliate disclaimer for more info.

Related Posts

View All Posts »