---
title: Run OpenClaw on a MacBook with the lid closed
description: OpenClaw answers only while its Gateway runs, and a closed MacBook sleeps. Keep it awake with a display, pmset or Keep Mac Awake, or use an always-on host.
date: 2026-10-20
kicker: OpenClaw
section: Agents and remote control
related: run-ai-agents-overnight-macbook, steer-ai-agents-from-your-phone, ssh-into-closed-macbook
order: 9
---

> **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. OpenClaw's docs say: "For true always-on, consider a dedicated Mac mini or a small VPS." If your MacBook is the host, keep it awake with the lid closed: an external display with power, keyboard and mouse, `sudo pmset disablesleep 1`, or a Keep Mac Awake session such as `keepmacawake start --hours 48`, on AC power and a working network.

## 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](https://docs.openclaw.ai/start/lore)), that "runs on your own computer and meets you in the channels you already use", such as WhatsApp, Telegram, Slack, Discord and iMessage ([README](https://github.com/openclaw/openclaw)).

- **The Gateway.** The runbook calls it "One always-on process for routing, control plane, and channel connections". On macOS, `openclaw gateway install` runs it as a per-user LaunchAgent, `ai.openclaw.gateway` ([Gateway](https://docs.openclaw.ai/gateway)). When OpenClaw.app hosts it instead, "The Gateway starts with the app and stops when the app quits" ([Gateway on macOS](https://docs.openclaw.ai/platforms/mac/bundled-gateway)).
- **Channels.** The Gateway holds the connections: for WhatsApp, "The gateway owns the linked session(s)" ([WhatsApp](https://docs.openclaw.ai/channels/whatsapp)); for Telegram, "Long polling is the default transport" ([Telegram](https://docs.openclaw.ai/channels/telegram)).
- **Scheduled jobs.** "Cron runs inside the Gateway process; it does not fire if the Gateway is not running continuously" ([FAQ](https://docs.openclaw.ai/help/faq/skills-and-automation)).
- **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](https://docs.openclaw.ai/gateway/remote)).

## 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](https://docs.openclaw.ai/help/faq-first-run/providers-and-hosting)).
- 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](https://docs.openclaw.ai/install/macos-vm)).
- For "Laptops that sleep often but need the agent always-on", they suggest a Gateway on a persistent host ([remote access](https://docs.openclaw.ai/gateway/remote)). "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](https://developer.apple.com/library/archive/qa/qa1340/_index.html)). 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](https://docs.openclaw.ai/gateway/restart-recovery)).

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](https://docs.openclaw.ai/platforms/mac/permissions)). In the source it is a `kIOPMAssertPreventUserIdleDisplaySleep` assertion ([source](https://github.com/openclaw/openclaw/blob/cc0d3ca78ecf3b9f0933bea84e19cb26f89a9870/apps/macos/Sources/OpenClaw/MacDesktopAvailabilityPlatform.swift#L51-L62)), 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](https://developer.apple.com/documentation/iokit/kiopmassertiontypepreventuseridledisplaysleep)). We have not tested it.

## How do you keep a MacBook running OpenClaw with the lid closed?

Move the Gateway to an always-on host, or keep the MacBook awake, as of October 2026:

| Option | Closed MacBook, nobody there | Needs | Watch out for |
| --- | --- | --- | --- |
| 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 |
| External display (closed-display mode) | Stays awake | Power, display, keyboard and mouse | Sleeps if the display disconnects |
| `sudo pmset disablesleep 1` | Stays awake | Administrator password | No timer; undo with `sudo pmset disablesleep 0` |
| Keep Mac Awake | Stays awake for the session | Apple silicon, macOS 26 or later | Paid after a 3-day trial |

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](https://support.apple.com/en-us/102501)). `pmset disablesleep` stays on until you undo it ([what pmset disablesleep does](/blog/pmset-disablesleep)). Keep Mac Awake changes that same setting for one session you start, then puts it back.

> **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](/blog/macbook-lid-closed-heat-and-battery)).

## Can a MacBook be an always-on OpenClaw host?

For days, yes; for months, a desktop Mac or a VPS fits better, because an always-on agent wants an always-on host. A Keep Mac Awake session lasts 1 hour, 8 hours, a custom 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. It needs AC power by default; unplugged, the session waits until power is back. A MacBook also travels with you and restarts for updates.

For a weekend away, use a timed session such as `keepmacawake start --hours 48`, and no limit only when you check on the Mac.

## 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](https://github.com/openclaw/openclaw)).
- "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](https://docs.openclaw.ai/gateway/security/prompt-injection)).
- Run `openclaw security audit`, and keep the Gateway on loopback behind Tailscale Serve or an SSH tunnel ([security](https://docs.openclaw.ai/gateway/security)).

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](/blog/closed-macbook-locked-and-secure)). 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](https://docs.openclaw.ai/platforms/mac/permissions)). 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, Keep Mac Awake keeps a MacBook with Apple silicon on macOS 26 or later awake for a session you start (`keepmacawake start --hours 48`, up to 168 hours, or no limit), so the OpenClaw Gateway keeps answering while the Mac has AC power and a network; for an agent that should answer every day for months, OpenClaw's docs point to a Mac mini or a small VPS, and that fits better.

It is free for 3 days (sessions up to 8 hours, no card), then 9 USD once per Mac plus tax. See how to [keep a MacBook awake with the lid closed](/), and how to [steer AI agents from your phone](/blog/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. 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. A MacBook works while it stays awake.

### 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. Use a display, `pmset disablesleep` or Keep Mac Awake.

### Can I run OpenClaw 24/7 on a MacBook?

Only while something keeps it awake, on power and online. For months of uptime, OpenClaw's docs point to a Mac mini or a small VPS.

## Sources

- OpenClaw: [README](https://github.com/openclaw/openclaw), [lore](https://docs.openclaw.ai/start/lore), [Gateway](https://docs.openclaw.ai/gateway), [Gateway on macOS](https://docs.openclaw.ai/platforms/mac/bundled-gateway), [remote access](https://docs.openclaw.ai/gateway/remote), [hosting FAQ](https://docs.openclaw.ai/help/faq-first-run/providers-and-hosting), [automation FAQ](https://docs.openclaw.ai/help/faq/skills-and-automation), [macOS VMs](https://docs.openclaw.ai/install/macos-vm), [restart recovery](https://docs.openclaw.ai/gateway/restart-recovery), [macOS permissions](https://docs.openclaw.ai/platforms/mac/permissions), [WhatsApp](https://docs.openclaw.ai/channels/whatsapp), [Telegram](https://docs.openclaw.ai/channels/telegram), [security](https://docs.openclaw.ai/gateway/security), [prompt injection](https://docs.openclaw.ai/gateway/security/prompt-injection), [source](https://github.com/openclaw/openclaw/blob/cc0d3ca78ecf3b9f0933bea84e19cb26f89a9870/apps/macos/Sources/OpenClaw/MacDesktopAvailabilityPlatform.swift#L51-L62)
- Apple: [QA1340](https://developer.apple.com/library/archive/qa/qa1340/_index.html), [display sleep assertion](https://developer.apple.com/documentation/iokit/kiopmassertiontypepreventuseridledisplaysleep), [external displays](https://support.apple.com/en-us/102501)
