Skip to content

Stop Your Mac Mini Sleeping So OpenClaw Stays Online

A sleeping Mac mini takes your OpenClaw agent offline, killing heartbeats, cron jobs, and channel connections. Fix it permanently with pmset, caffeinate, Energy settings, or Amphetamine, and make sure the Gateway comes back on its own after reboots.

The Mac mini is a popular OpenClaw host for a good reason: it is quiet, cheap to run, and powerful enough to sit in a corner serving your agent all day. Then you message your agent from your phone and get silence. You come home, wiggle the mouse, and everything springs back to life. The machine was asleep. Every hour it slept, heartbeats stopped, cron jobs were missed, and your WhatsApp or Telegram channel sat offline. macOS is built to save power on an idle desktop, and by default it will put an "idle" Mac mini to sleep even though your Gateway is quietly doing scheduled work.

Why the Mac mini sleep problem takes your agent offline

When macOS enters system sleep, the network stack and background processes are suspended. The OpenClaw Gateway process is frozen mid-run: WebSocket connections to channels drop, scheduled jobs never fire, and remote devices cannot reach the Control UI. Waking the machine restores the process, which is why everything looks fine whenever you are physically at the keyboard. The fix is to keep the system awake while letting the display sleep, which costs almost nothing on a Mac mini.

Fix it with pmset (permanent, recommended)

These commands change power management at the system level and survive reboots.

  1. Audit your current settings.
    pmset -g
    Look at the sleep, disksleep, and powernap lines. Any non-zero sleep value means the machine will eventually sleep.
  2. Disable system and disk sleep.
    sudo pmset -a sleep 0 disksleep 0
  3. Let the display sleep anyway. The screen is irrelevant to a headless agent host, so save the power:
    sudo pmset -a displaysleep 10
  4. Disable Power Nap and standby. These half-awake states can still interrupt long-running processes:
    sudo pmset -a powernap 0 standby 0 autopoweroff 0
  5. Recover from power cuts and enable remote wake. Auto-restart brings the mini back after an outage, and wake-on-network lets you nudge it remotely:
    sudo pmset -a autorestart 1 womp 1
  6. Verify.
    pmset -g
    Confirm sleep 0, powernap 0, and autorestart 1. You can also run pmset -g assertions at any time to see which processes are currently holding the machine awake.

Prefer clicking to typing? The same result lives in System Settings under Energy: enable "Prevent your Mac from automatically sleeping when the display is off" and "Start up automatically after a power failure".

Alternative: caffeinate, scoped and reversible

If you do not want to change global power settings, caffeinate holds a sleep-prevention assertion only while it runs:

caffeinate -s

The -s flag prevents system sleep while on AC power. To make this survive logins and reboots, wrap it in a LaunchAgent at ~/Library/LaunchAgents/com.user.caffeinate.plist:

<?xml version="1.0" encoding="UTF-8"?>
<plist version="1.0">
<dict>
  <key>Label</key><string>com.user.caffeinate</string>
  <key>ProgramArguments</key>
  <array>
    <string>/usr/bin/caffeinate</string>
    <string>-s</string>
  </array>
  <key>RunAtLoad</key><true/>
  <key>KeepAlive</key><true/>
</dict>
</plist>
launchctl load ~/Library/LaunchAgents/com.user.caffeinate.plist

A third option is Amphetamine, a free Mac App Store utility that keeps the machine awake on a schedule or while specific apps run. It is the friendliest route if you share the mini with other uses and only want it awake during certain hours.

Make the Gateway come back on its own

Staying awake is half the job; the other half is recovering without you. OpenClaw's standard macOS install runs the Gateway as a launchd service with KeepAlive, so it restarts automatically after a crash. Check the service state with:

openclaw gateway status
openclaw daemon status

Two extra settings close the remaining gaps. First, since LaunchAgents start at login, enable automatic login for the account that runs the Gateway (System Settings, then Users & Groups) so a power-failure reboot goes all the way back to a running agent. Second, if you use FileVault, note that a reboot will stop at the disk-unlock screen until someone types the password, so weigh disk encryption against unattended recovery for a dedicated agent host.

The honest trade-off

With the settings above, a Mac mini is a genuinely solid always-on host. It still shares one weakness with every home machine: it depends on your home power, your residential internet, and nobody tripping over a cable. If you want to skip the sleeping-hardware problem entirely, a small always-on VPS runs OpenClaw around the clock without any of these workarounds.

Does the display sleeping affect OpenClaw?

No. Display sleep only turns off the video output; the system keeps running. Let the display sleep aggressively to save power. Only system sleep suspends the Gateway. On a MacBook, closing the lid forces system sleep regardless of pmset or caffeinate, so keep the lid open if a laptop is your host.

Should I use pmset or caffeinate?

Use pmset for a dedicated agent host: it is persistent, survives reboots, and needs no running process. Use caffeinate or Amphetamine when the mini is also a personal machine and you want sleep prevention scoped to certain hours or conditions instead of disabled globally.

Will OpenClaw restart automatically after a reboot?

Yes, provided the account logs in. The Gateway runs as a launchd service with KeepAlive, so it respawns after crashes and starts at login. Combine that with pmset autorestart 1 and automatic login, and the machine can lose power, boot back up, and return your agent online with no hands on the keyboard.

Frequently asked questions

Does the display sleeping affect OpenClaw?
No. Display sleep only turns off the video output; the system keeps running. Let the display sleep aggressively to save power. Only system sleep suspends the Gateway. On a MacBook, closing the lid forces system sleep regardless of pmset or caffeinate, so keep the lid open if a laptop is your host.
Should I use pmset or caffeinate?
Use pmset for a dedicated agent host: it is persistent, survives reboots, and needs no running process. Use caffeinate or Amphetamine when the mini is also a personal machine and you want sleep prevention scoped to certain hours or conditions instead of disabled globally.
Will OpenClaw restart automatically after a reboot?
Yes, provided the account logs in. The Gateway runs as a launchd service with KeepAlive, so it respawns after crashes and starts at login. Combine that with pmset autorestart 1 and automatic login, and the machine can lose power, boot back up, and return your agent online with no hands on the keyboard.
OpenClaw Mac Mini Sleep: Keep Your Agent Online 24/7