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
| Symptom | Likely cause |
|---|---|
| Replies arrive in a burst when you wake the Mac | System sleep, part 1 |
| Silent after every reboot, Mac awake | No automatic login, part 2 |
| Silent after a power cut | autorestart not set |
| Works locally, unreachable remotely | Network, not power. Check the bind mode and the port. |
| Unauthorized errors after a token change | Stale 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.
Related guides
- OpenClaw stuck on starting, or the gateway will not come upA gateway that hangs on starting is nearly always failing for a reason it already wrote to the logs. Read the logs first, because the five causes below have five different fixes and guessing between them wastes the most time.
- OpenClaw error: gateway connect failed, pairing requiredThis error means the gateway is running and reachable, but it does not trust the client that just connected. Nothing is broken. The device simply has no approved identity yet, and there are four different reasons that can happen.
- Where is the OpenClaw config file, and how do you change its location?The short answer is ~/.openclaw/openclaw.json, written in JSON5. The longer answer matters when your edits appear to be ignored, which is almost always a second config file or an environment variable winning over the one you edited.
- How to Fix "Hermes backend exited before it became ready"The number in the brackets decides everything. Zero means a healthy backend shut itself down, usually a Windows watchdog misfire, and any other number means it genuinely failed, usually an update applied while Hermes was still running.
