Keep a MacBook awake with the lid closed: guides and comparisons
Guides for running AI agents and long jobs on a MacBook with the lid closed, steering them from your phone, and choosing a keep-awake tool. Every post answers one question first, then shows the steps, the free options and their trade-offs.
Steer your coding agents from your phone while your Mac stays closed
Claude Code, Codex and Cursor can be steered from a phone, but each needs your Mac awake and online. How to keep it working with the lid closed.
Read the guideAgents and remote control
- Claude Code
How to keep Claude Code running with your MacBook lid closed
Closing a MacBook's lid puts it to sleep, and Claude Code stops with it. Keep it working with an external display or a Keep Mac Awake session.
- Remote Control
Claude Code Remote Control with the lid closed
Remote Control goes offline when your Mac sleeps, and closing the lid sleeps it. Keep the Mac awake with the lid closed to stay reachable.
- Codex
Use Codex from your phone with the MacBook lid closed
Codex remote access needs an awake Mac, and closing the lid puts a MacBook to sleep. Use an external display, or Keep Mac Awake with no display.
- Claude
Claude Code Remote Control vs Dispatch: which one keeps working
Remote Control drives a claude session on your Mac, Dispatch hands a task to the Claude desktop app. Both stop when the Mac sleeps; cloud sessions don't.
- Cursor
Cursor remote control with the MacBook lid closed
Cursor remote control runs agents on your Mac, so it must stay awake and online, and closing the lid sleeps it. How to keep it working with the lid closed.
- Overnight
Run AI coding agents overnight on a MacBook
An overnight agent run needs an awake Mac, power, network and the right permissions. A MacBook can do it lid closed with a timed Keep Mac Awake session.
- SSH
SSH into a closed MacBook with Tailscale and tmux
A closed MacBook sleeps and stops answering SSH. Use Remote Login, Tailscale and tmux, and keep the Mac awake with a Keep Mac Awake session.
- OpenClaw
Run OpenClaw on a MacBook with the lid closed
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.
- macOS
Power Nap and Wake for network access do not keep agents running
Power Nap syncs Mail, Calendar and iCloud while a Mac sleeps; Wake for network access serves shared resources. Neither keeps an AI agent working.
The closed lid, explained
- Lid closed
How to prevent a MacBook from sleeping when the lid is closed
A MacBook sleeps when the lid closes unless closed-display mode or the SleepDisabled setting is on. Every method compared, and what to use.
- Troubleshooting
MacBook still sleeps with the lid closed? How to fix it
Find the sleep reason with pmset -g log, then fix it: caffeinate alone, a lost display or charger, pmset without sudo, a reset setting, battery or heat.
- Clamshell
Clamshell mode without an external monitor on a MacBook
Apple's closed-display mode needs a display, keyboard, mouse and power. How to keep a MacBook awake with the lid closed without them, and the trade-offs.
- caffeinate
Why caffeinate does not keep your MacBook awake with the lid closed
caffeinate only holds power assertions, and a MacBook with no external display still sleeps when the lid closes. What works from Terminal instead.
- pmset
sudo pmset disablesleep 1: what it does and how to undo it
It turns on SleepDisabled: no sleep at all, lid closed or not, even after a restart, until sudo pmset disablesleep 0. How to check it and undo it.
- Built in
How to keep a Mac awake without installing an app
macOS has three built-in ways: System Settings, caffeinate and pmset. Exact menu paths, Terminal recipes for downloads and timers, and their limits.
- Security
Is a closed MacBook locked while it keeps working?
Yes, if Lock Screen asks for a password when the display turns off. Agents keep running behind the lock. What the lock, FileVault and Find My cover.
- Safety
Is it safe to run a MacBook with the lid closed?
Yes, with airflow: Apple supports closed-lid use. The real risks are bags, soft surfaces, hot rooms and a draining battery. Rules for unattended runs.
Comparisons
- Compare
Keep-awake apps for AI agents on a Mac, compared
Nine ways to keep a Mac awake for AI agents as of October 2026, compared on lid closed, method, watchdog, heat and battery, agent interface and price.
- Compare
An Amphetamine alternative for running with the lid closed
Amphetamine is free and keeps a closed MacBook awake with Closed-Display Mode and Power Protect. When it fits, and when Keep Mac Awake fits better.