Skip to content

OpenClaw stops responding when the Mac mini goes to sleep

A Mac mini running an always-on agent has two separate problems, and fixing only the obvious one leaves you with an agent that still goes quiet. Sleep is the first. The second is that a LaunchAgent needs a logged-in user.

The symptom is unmistakable. Messages sent while you are away get no reply, then everything arrives at once the moment you touch the Mac. The agent is not broken, the machine was asleep and nothing was running.

Part 1: stop the Mac from sleeping

All of these are pmset, the built-in macOS power tool. -a applies to every power source.

sudo pmset -a sleep 0        # never sleep the system
sudo pmset -a disksleep 0    # never spin down the disk
sudo pmset -a autorestart 1  # come back after a power cut
sudo pmset -a womp 1         # allow wake for network access

Deliberately absent is displaysleep. Let the display sleep. It saves most of the power, it does not affect a background service, and a Mac mini usually has no display attached anyway.

Check what actually applied:

pmset -g

Read the output rather than assuming. Some settings are refused on some hardware, and pmset does not always complain loudly when it ignores one.

Laptops, or anything with a lid

sudo pmset -a disablesleep 1

This keeps the machine running with the lid closed. Apple treats it as an advanced setting because a closed laptop has nowhere to put its heat, so use it on a machine with airflow and not one living in a bag.

A temporary alternative

caffeinate -dimsu

This holds the Mac awake for as long as the command runs, which is useful for a one-off but not a solution, because it dies with your terminal session and does not survive a reboot.

Part 2: the part everyone misses

Fix sleep and you will still find the agent silent after a restart, on a Mac that is plainly awake.

OpenClaw installs on macOS as a LaunchAgent, named bot.molt.gateway. A LaunchAgent runs inside a user session, which means it starts when a user logs in and not before. Reboot a Mac mini that sits at the login screen and nothing ever starts, no matter how awake the machine is.

Two ways to solve it:

  • Enable automatic login in System Settings, under Users and Groups. Simple, and the right answer for a dedicated machine on a trusted network. It does mean the Mac boots straight into an unlocked session, so weigh that against who can physically reach it.
  • Do not rely on it at all. If the agent has to be up whether or not anyone is logged in, a desktop machine is the wrong place for it. That is what a server is for.

Part 3: what to check when it goes quiet anyway

SymptomLikely cause
Replies arrive in a burst when you wake the MacSystem sleep, part 1
Silent after every reboot, Mac awakeNo automatic login, part 2
Silent after a power cutautorestart not set
Works locally, unreachable remotelyNetwork, not power. Check the bind mode and the port.
Unauthorized errors after a token changeStale launchd env, run launchctl unsetenv OPENCLAW_GATEWAY_TOKEN

The honest summary

A Mac mini makes a decent always-on host once sleep and automatic login are both handled, and it is genuinely cheap if the machine is already sitting there. What it will not do is survive a power cut, an OS update prompt, or someone unplugging it to free a socket, and each of those looks exactly like the agent being broken. If none of that is acceptable, the machine is the problem rather than the configuration.

Frequently asked questions

Does closing a MacBook lid count?
Yes, and it is stricter than a Mac mini. A closed lid sleeps the machine unless disablesleep is set, which Apple treats as an advanced setting for good reason.
Is keeping a Mac awake permanently bad for it?
It runs warmer and draws more power. The display can still sleep, which is most of the saving, so keep displaysleep on and only stop the system from sleeping.
Why does the agent stop even though the Mac is awake?
Because a LaunchAgent only runs while a user is logged in. After a reboot with no automatic login, nothing starts, and the Mac looks perfectly awake the whole time.
Fix: OpenClaw stops when the Mac mini sleeps