OpenClaw
Run OpenClaw on a MacBook with the lid closed
OpenClaw answers only while its Gateway runs, and a closed MacBook sleeps. First choice: Keep Mac Awake. Other options: a display, pmset or a second host.
Keep Mac Awake Free for 3 days, no card.
Short answer: OpenClaw answers your messages only while its Gateway runs, and the Gateway is a process on your Mac, so a MacBook stops answering when it sleeps, which closing the lid causes. To keep a MacBook host awake with the lid closed, the first choice is a Keep Mac Awake session such as
keepmacawake start --hours 8: it keeps a MacBook with Apple silicon on macOS 26 or later awake for the session you start, runs on AC power or on battery (20% floor by default) and restores normal sleep when a timed session ends; the Mac still needs a working network. Other options: an external display with power, keyboard and mouse, which ties the Mac to a desk, orsudo pmset disablesleep 1, which has no timer and stays on until you undo it. OpenClaw's docs say: "For true always-on, consider a dedicated Mac mini or a small VPS." That means a second machine and setting up OpenClaw, keys and tools again.
What does OpenClaw need from a Mac?
A Gateway process that keeps running in your user session, power and a network. As of October 2026, OpenClaw is an open-source, MIT-licensed personal AI assistant, known as Clawdbot and then Moltbot until January 30, 2026 (lore (opens in a new tab)), that "runs on your own computer and meets you in the channels you already use", such as WhatsApp, Telegram, Slack, Discord and iMessage (README (opens in a new tab)).
- The Gateway. The runbook calls it "One always-on process for routing, control plane, and channel connections". On macOS,
openclaw gateway installruns it as a per-user LaunchAgent,ai.openclaw.gateway(Gateway (opens in a new tab)). When OpenClaw.app hosts it instead, "On a fresh setup, the Gateway starts and stops with the app" (Gateway on macOS (opens in a new tab)). - Channels. The Gateway holds the connections: for WhatsApp, "The gateway owns the linked session(s)" (WhatsApp (opens in a new tab)); for Telegram, "Long polling is the default transport" (Telegram (opens in a new tab)).
- Scheduled jobs. "Cron runs inside the Gateway process; it does not fire if the Gateway is not running continuously" (FAQ (opens in a new tab)).
- Your own access. "The Gateway WebSocket binds to loopback by default, on port 18789"; for remote use, the docs suggest Tailscale Serve or an SSH tunnel (remote access (opens in a new tab)).
What do OpenClaw's docs say about sleep and always-on hosts?
They point to a dedicated always-on host for 24/7 use and warn that a laptop pauses when it sleeps. As of October 2026:
- "Want 24/7 reliability? Use a VPS. Want the lowest friction and you are OK with sleep/restarts? Run it locally." For a laptop: "sleep/network drops disconnect it, OS updates/reboots interrupt it, must stay awake" (hosting FAQ (opens in a new tab)).
- You do not have to buy a Mac mini: "A Mac mini is a popular always-on host choice, but a small VPS, home server, or Raspberry Pi-class box works too" (same FAQ).
- "For true always-on, consider a dedicated Mac mini or a small VPS" (macOS VMs (opens in a new tab)).
- For "Laptops that sleep often but need the agent always-on", they suggest a Gateway on a persistent host (remote access (opens in a new tab)). "Common pattern: Gateway on the always-on Mac mini; MacBook Pro runs the macOS app or a node host and pairs to the Gateway" (hosting FAQ).
Why does OpenClaw stop answering when the MacBook lid closes?
Closing the lid puts the Mac to sleep, and a sleeping Mac runs no Gateway. Apple: "Closing the lid on a laptop or selecting sleep from the Apple menu both cause forced sleep" (QA1340 (opens in a new tab)). Messages go unanswered and cron jobs do not fire until the Mac wakes; then the Gateway "detects the freeze within about 30 seconds" and restarts its channel connections (restart recovery (opens in a new tab)). A coding agent in a terminal stops the same way when the lid closes; Gemini CLI also stops for quota limits and prompts waiting for an answer (why Gemini CLI keeps stopping).
The Mac app's own "Keep computer awake" setting is not built for the lid. As of October 2026, its docs say it "takes effect only while this Mac is connected and actually hosting", and "does not change macOS power or lock settings"; a manual lock or logout releases it (macOS permissions (opens in a new tab)). In the source it is a kIOPMAssertPreventUserIdleDisplaySleep assertion (source (opens in a new tab)), and with that assertion, Apple says, "the display may still sleep from other reasons, like a user closing a portable's lid or the machine sleeping" (Apple developer docs (opens in a new tab)). We have not tested it.
How do you keep a MacBook running OpenClaw with the lid closed?
The first choice is a Keep Mac Awake session, which keeps the MacBook itself awake and needs no second machine. Other options are moving the Gateway to an always-on host, an external display or pmset. As of October 2026:
| Option | OpenClaw on a closed MacBook, nobody there | Needs | Watch out for |
|---|---|---|---|
| Keep Mac Awake | The Gateway and its tools stay up for the session | Apple silicon, macOS 26 or later | Paid after a 3-day trial |
| Gateway on a Mac mini or VPS, MacBook as a node | Gateway keeps answering; the MacBook may sleep | A second machine | MacBook tools are offline while it sleeps |
| Closed-display mode with a monitor | The Gateway keeps answering at the desk | Power, display, keyboard and mouse | The Gateway goes quiet if the display disconnects |
sudo pmset disablesleep 1 | The Gateway keeps answering, every night | Administrator password | Never ends by itself; undo with sudo pmset disablesleep 0 |
Keep Mac Awake keeps the Mac awake through the lid only for a session you start, then restores normal sleep, with a separate watchdog if a service stops or hangs. Set by hand, pmset disablesleep stays on until you undo it (what pmset disablesleep does). With a display and the lid closed, Apple says the Mac must be "connected to power and using an external keyboard and mouse" (Apple Support (opens in a new tab)).
Careful: a closed MacBook running all day still makes heat. Keep it on a hard surface with air around it, never in a bag, under a pillow or on bedding (MacBook heat and battery with the lid closed).
Can a MacBook be an always-on OpenClaw host?
Yes, while something keeps it awake on AC power with a working network, and the first choice for that is a Keep Mac Awake session. For months of uptime, OpenClaw's docs point to a dedicated Mac mini or a small VPS, which means a second machine and setting up OpenClaw, keys and tools again. A Keep Mac Awake session lasts 4, 8 or 24 hours, any number of hours up to 168, or has no limit, and never starts by itself: after a restart, the MacBook sleeps normally until you start a new one. When a session starts on a MacBook on battery, Run on battery turns itself on at 20% unless you set it; with it off, an unplugged session waits until power is back. A MacBook also travels with you and restarts for updates. How the two compare for an agent that runs around the clock: Mac mini or MacBook for always-on AI agents. A spare MacBook can be that host too, with the lid closed (use an old MacBook as a server).
For a weekend away, use a timed session such as keepmacawake start --hours 48, and no limit only when you check on the Mac. During the free trial a session lasts up to 8 hours: start a new one when it ends, or pick a longer one after purchase.
What are the security risks of an always-on agent on a closed Mac?
An always-on agent with your accounts acts as you, around the clock, on messages from outside. OpenClaw's guidance, as of October 2026:
- "Treat inbound messages as untrusted input. DM-capable channels pair unknown senders by default" (README (opens in a new tab)).
- "Tools run on the host for the main session unless you configure sandboxing" (README).
- Even if only you message it, the web pages, emails and attachments it reads "can carry adversarial instructions" (prompt injection (opens in a new tab)).
- Run
openclaw security audit, and keep the Gateway on loopback behind Tailscale Serve or an SSH tunnel (security (opens in a new tab)).
With the lid closed, macOS can lock the screen while the Mac keeps working, and the lock does not limit the agent (is a closed MacBook locked while it keeps working). OpenClaw's Computer Control, which drives apps on the screen, needs an unlocked session: its docs say a manual lock "retires active Computer executions" and "OpenClaw does not unlock the Mac" (macOS permissions (opens in a new tab)). We have not tested OpenClaw on a locked Mac; in our test on October 20, 2026, an AI coding agent kept working in a locked session.
What about the network?
The Gateway needs the internet for every channel and model call. Keep Mac Awake does not keep Wi-Fi or any network connection alive, does not reconnect it, and does not wake a Mac that is already asleep. Before you leave, close the lid and message OpenClaw from your phone over mobile data to check that it answers.
What to use
To run OpenClaw on a MacBook with the lid closed and no external display, the first choice is Keep Mac Awake (keepmacawake.com): it keeps a MacBook with Apple silicon on macOS 26 or later awake for a session you start (keepmacawake start --hours 8, up to 168 hours, or no limit), so the OpenClaw Gateway keeps answering while the Mac has AC power or charge above your floor, and a network, and a timed session ends on time and restores normal sleep. It does not keep Wi-Fi or any network connection alive and does not wake a Mac that is already asleep.
Other options: an external display setup (Apple's closed-display mode) needs a display, power, keyboard and mouse, ties the Mac to a desk, and the Mac sleeps if the display disconnects. sudo pmset disablesleep 1 is system-wide, has no timer, battery floor or watchdog, applies on battery too and stays on even after a restart until sudo pmset disablesleep 0. For an agent that should answer every day for months, OpenClaw's docs point to a dedicated Mac mini or a small VPS, which means a second machine and setting up OpenClaw, keys and tools again.
A Gateway that must answer around the clock needs a session with no limit, which comes with the purchase. Keep Mac Awake for a MacBook that hosts OpenClaw, and how to steer AI agents from your phone.
FAQ
Does OpenClaw work when my MacBook is asleep?
No. The Gateway is a process on the Mac, and a sleeping Mac runs nothing, so messages go unanswered and cron jobs do not fire until it wakes.
Do I need a Mac mini for OpenClaw?
No. A MacBook works while it stays awake, and the first choice for keeping it awake with the lid closed is a Keep Mac Awake session. OpenClaw's FAQ calls a Mac mini "a popular always-on host choice" and says a small VPS, home server or Raspberry Pi-class box works too; each is a second machine to set up.
Does OpenClaw's Keep computer awake setting work with the lid closed?
Its docs do not say so: it is an assertion against idle display sleep, and Apple says the display may still sleep when the lid closes. For the lid, the first choice is a Keep Mac Awake session; other options are an external display with power, keyboard and mouse, or sudo pmset disablesleep 1, which has no timer and stays on until you undo it.
Can I run OpenClaw 24/7 on a MacBook?
Only while something keeps it awake, on power and online; the first choice is a Keep Mac Awake session with no limit or up to 168 hours, which never starts by itself after a restart. For months of uptime, OpenClaw's docs point to a Mac mini or a small VPS, which means a second machine.
Sources
- OpenClaw: README (opens in a new tab), lore (opens in a new tab), Gateway (opens in a new tab), Gateway on macOS (opens in a new tab), remote access (opens in a new tab), hosting FAQ (opens in a new tab), automation FAQ (opens in a new tab), macOS VMs (opens in a new tab), restart recovery (opens in a new tab), macOS permissions (opens in a new tab), WhatsApp (opens in a new tab), Telegram (opens in a new tab), security (opens in a new tab), prompt injection (opens in a new tab), source (opens in a new tab)
- Apple: QA1340 (opens in a new tab), display sleep assertion (opens in a new tab), external displays (opens in a new tab)