Keep a MacBook awake with the lid closed: guides and comparisons
Answers for running AI agents and long jobs on a MacBook with the lid closed: why it sleeps, what each agent needs, how to steer it from your phone, and how the keep-awake apps compare. Every post answers its question first, then gives the steps, the commands and the sources.
Keep Mac Awake, which we make, keeps a MacBook with Apple silicon awake with the lid closed for a session you or your agent start, on AC power or on battery (20% floor by default), with a separate watchdog that restores normal sleep if a service stops or hangs. The guides below say what each setting and command does, where it stops, and when to start a session.
Start here
- How to prevent a MacBook from sleeping when the lid is closed
- How to keep Claude Code running with your MacBook lid closed
- Control AI coding agents from your phone
- Which keep-awake app should you use for AI agents on a Mac?
- Amphetamine Power Protect and a closed-lid alternative
- Why does Claude Code keep stopping?
- Codex remote control from your phone with the lid closed
- Claude Code Remote Control with the lid closed
- SSH into a closed MacBook from an iPhone with Tailscale
- Cursor remote control with the MacBook lid closed
- Mac keeps going to sleep? How to stop it
- Free tools for Mac sleep and power
Keep an AI agent running with the lid closed
Per tool: what stops Claude Code, Codex, Cursor and the other agents when a MacBook sleeps, and the setup that keeps each one working. The overview is run AI agents overnight on a MacBook.
- 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 a Keep Mac Awake session, no external display needed.
- Claude Code
Why does Claude Code keep stopping?
Claude Code stops when the Mac sleeps, a usage limit hits, a prompt waits for you or the process ends. Keep Mac Awake keeps a closed MacBook working.
- Claude Code
Claude Code status line: show if your Mac will stay awake
Keep Mac Awake in your Claude Code status line, ccstatusline, tmux, Starship or SwiftBar: see if your Mac stays awake with the lid closed, and until when.
- Claude Code
Claude scheduled tasks not running on Mac?
Local Claude scheduled tasks skip while the Mac sleeps, and a closed lid sleeps it. Keep Mac Awake keeps a closed MacBook awake so each run fires.
- Claude Cowork
Close my laptop while Claude Cowork runs?
Yes for Cowork in the cloud, no when it uses your files, browser or apps. Keep Mac Awake keeps a closed MacBook awake so those tasks can finish.
- Codex
Why does Codex keep stopping on a Mac?
Sleep, a dropped stream, an approval, a safety check or a closed app: how to tell which and fix it. Keep Mac Awake keeps a closed MacBook working.
- Codex
Codex automations not running on a Mac?
Local Codex automations need the Mac on and the ChatGPT app running, and a closed lid sleeps a MacBook. Keep Mac Awake keeps it awake with the lid closed.
- Cursor
Why does the Cursor agent keep stopping?
A local Cursor agent stops when the Mac sleeps, waits for approval, hits a usage limit or loses the network. Keep Mac Awake keeps a closed MacBook working.
- Gemini CLI
Why does Gemini CLI keep stopping?
Gemini CLI stops on quota limits, approval prompts, loop detection, the sandbox, crashes and Mac sleep. Keep Mac Awake keeps a closed MacBook working.
- Copilot CLI
How to keep GitHub Copilot CLI running with the lid closed
Copilot CLI stops when the Mac sleeps, and closing the lid sleeps a MacBook. Keep Mac Awake keeps it working with the lid closed and no external display.
- 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.
- ChatGPT
Can I close my laptop while ChatGPT works?
Yes: deep research and agent mode run on OpenAI's side. Which local ChatGPT work needs your Mac awake, and how Keep Mac Awake keeps a closed MacBook awake.
- Overnight
Run AI coding agents overnight on a MacBook
A checklist for one night alone: Keep Mac Awake for the closed lid, power, network, the allow rules each agent needs, and how the agent ends the session.
- Always on
Mac mini or MacBook for OpenClaw and always-on AI agents
Keep Mac Awake lets the MacBook you own run OpenClaw and other AI agents 24/7 with the lid closed. What a Mac mini adds, and how to choose.
- Local AI
Run Ollama with the MacBook lid closed
A closed MacBook sleeps, so Ollama and LM Studio stop answering. Keep Mac Awake keeps it awake with the lid closed and no display for local AI jobs.
- ComfyUI
How do I keep a Mac awake while ComfyUI renders?
To keep a closed MacBook awake while ComfyUI renders, the first choice is Keep Mac Awake. ComfyUI has no such setting; its sleep node stops idle sleep.
Control agents from your phone or another computer
Remote Control, SSH, Screen Sharing and Tailscale on a closed MacBook: what keeps the connection and what drops it. The hub is control AI coding agents from your phone.
- Remote work
Control AI coding agents from your phone
Control Claude Code, Codex, Cursor, Amp or T3 Code from a phone. All need your Mac awake and online; Keep Mac Awake keeps it working with the lid closed.
- 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 Mac Awake keeps a closed Mac awake so Claude Code keeps running.
- Claude
Claude Code Remote Control vs Dispatch: which one keeps working
Remote Control and Dispatch run Claude on your Mac and stop when it sleeps. Keep Mac Awake keeps a closed Mac awake; cloud sessions run without your Mac.
- Codex
Codex remote control from your phone with the lid closed
Codex remote control from the ChatGPT app needs an awake Mac, and a closed lid sleeps it. Keep Mac Awake keeps it awake with the lid closed and no display.
- Cursor
Cursor remote control with the MacBook lid closed
Cursor remote control runs agents on your Mac, and closing the lid sleeps it. Keep Mac Awake keeps the Mac awake with the lid closed and no display.
- Antigravity
Antigravity CLI and Gemini CLI remote control, lid closed
Antigravity Remote Control reaches your Mac only while it is awake, and closing the lid sleeps it. Keep Mac Awake keeps a closed MacBook awake.
- SSH
SSH into a closed MacBook from an iPhone with Tailscale
SSH into your Mac from an iPhone with Remote Login, Tailscale and tmux. A closed MacBook sleeps; a Keep Mac Awake session keeps it awake.
- Screen Sharing
Use Screen Sharing on a MacBook with the lid closed
Screen Sharing reaches a Mac only while it is awake, and a closed MacBook sleeps. Keep Mac Awake keeps it awake with the lid closed and no display.
- Tailscale
Does Tailscale work when your Mac is asleep?
No: a sleeping Mac drops off your tailnet until it wakes. Keep it awake, lid closed too, with a Keep Mac Awake session started before you leave.
- macOS
What Wake for network access and Power Nap do on a Mac
What each does while the Mac sleeps, how to check it with pmset (womp, powernap), and why neither keeps an agent running; for that, use Keep Mac Awake.
The closed lid, explained
What macOS does when the lid closes, the settings that change it, and what heat, battery and security mean for a closed MacBook. Start with keep a MacBook from sleeping when the lid is closed.
- Lid closed
How to prevent a MacBook from sleeping when the lid is closed
Keep Mac Awake keeps a closed MacBook awake for a session you start, on AC power or on battery. Every other method compared, and what to use.
- Troubleshooting
MacBook shuts down when the lid closes? How to fix it
Clamshell mode, caffeinate or pmset disablesleep not holding? Read the reason in pmset -g log and fix it; Keep Mac Awake keeps a closed MacBook awake.
- Clamshell
MacBook clamshell mode without a monitor or power
No monitor or power? Keep Mac Awake keeps a closed MacBook awake, on battery too. Apple's clamshell mode needs both; open the lid to turn it off.
- Settings
MacBook lid close settings: what macOS lets you change
To keep a closed MacBook awake, the first choice is Keep Mac Awake: macOS has no lid close setting. What macOS 26 does let you change, and where.
- Safety
Is clamshell mode bad for a MacBook? Heat and battery
A closed MacBook is safe with air around it and on power. Apple's room range, what traps heat, pmset -g therm, how Keep Mac Awake limits a battery session.
- Security
Is a closed MacBook locked while it keeps working?
Yes, if Lock Screen asks for a password when the display turns off. How to set and check it, and what FileVault covers in a Keep Mac Awake session.
- Lid closed
Does a mouse jiggler keep a closed MacBook awake?
No. A jiggler simulates input to stop idle sleep, but closing the lid is forced sleep. For a closed MacBook, the first choice is Keep Mac Awake.
- Sound
How to mute a MacBook when the lid closes
A MacBook kept awake overnight still plays agent alerts. Keep Mac Awake can mute it while the lid is closed and give the sound back when you open it.
When a Mac sleeps too soon, or will not sleep
Idle sleep, the display, and the reasons a Mac stays awake or wakes up. To read your own Mac's sleep settings and wake reasons, use the free tools.
- Troubleshooting
Mac keeps going to sleep? How to stop it
Find why your Mac slept in pmset -g log, then fix it. To keep it awake for a task, lid open or closed, the first choice is Keep Mac Awake.
- Sleep
MacBook not sleeping when the lid is closed
A closed MacBook that stays awake has a display connected or sleep turned off. Find the cause; Keep Mac Awake keeps it awake only when you choose.
- Reference
What keeps a Mac awake on AC and battery, lid open or closed?
Keep Mac Awake, caffeinate flags, pmset, System Settings and apps: what keeps a Mac awake on AC and battery, lid open or closed. A dated, sourced table.
- Display
How to keep a Mac screen from turning off
Your Mac's screen turns off on the Lock Screen timers. Lengthen them or run caffeinate -d; to keep a closed MacBook working, use Keep Mac Awake.
- Display
How to turn off a Mac screen without putting it to sleep
First choice on a MacBook: a Keep Mac Awake session, then close the lid. Lid open: pmset displaysleepnow turns the screen off and the Mac keeps running.
- pmset log
What is DarkWake on a Mac?
DarkWake is a Mac running with the display off. How to read it in pmset -g log, and how Keep Mac Awake keeps a closed MacBook working.
Terminal commands: caffeinate and pmset
One command per page: what it does with the lid closed, on AC power and on battery, and where it stops. How the commands and Keep Mac Awake differ is in keep a Mac awake without an app.
- Lid closed
Does caffeinate keep a MacBook awake with the lid closed?
Only caffeinate -s, on AC power only, keeps a closed MacBook running, in dark wake. Other flags stop at the lid. The first choice is Keep Mac Awake.
- Built in
How to keep a Mac awake without installing an app
For a closed lid, Keep Mac Awake first. Without an app: the System Settings paths, caffeinate and pmset commands with their undo, and what each cannot do.
- pmset
sudo pmset disablesleep 1: lid closed, and how to undo it
sudo pmset disablesleep 1 stops all sleep, lid closed too, until sudo pmset -a disablesleep 0; pmset -g checks it. Or use a Keep Mac Awake session.
- pmset
What does sudo pmset sleep 0 do?
sudo pmset sleep 0 turns off idle sleep on every power source, but a closed MacBook still sleeps. Check and undo it, or keep it awake with Keep Mac Awake.
- pmset
pmset hibernatemode 3 vs 25: what is the difference?
hibernatemode 3 keeps memory powered in sleep; 25 writes it to disk and powers off. Neither keeps a closed MacBook awake; Keep Mac Awake does.
- pmset
What does pmset -g assertions mean?
pmset -g assertions lists what holds off sleep and which process holds it. How to read each line and keep a closed MacBook awake with Keep Mac Awake.
Close the lid while something runs
Downloads, backups, uploads, renders, servers and music: what keeps going on a closed MacBook and what stops.
- Downloads
Do downloads continue with the lid closed?
No: a closed MacBook sleeps and downloads stop. Keep Mac Awake keeps it awake with the lid closed and no display, so a large download can finish.
- Downloads
Battle.net Update Agent went to sleep on a Mac: what now?
The error means the Battle.net app lost touch with its Update Agent. Blizzard's Mac fixes in order, and Keep Mac Awake for a closed MacBook.
- File transfers
Can I close my laptop while copying or syncing files?
No: a closed MacBook sleeps, and a copy or an iCloud, Google Drive or Dropbox sync stops. Keep Mac Awake keeps it awake with the lid closed.
- YouTube uploads
Close my laptop while uploading to YouTube?
Not until the upload reaches 100%: a closed MacBook sleeps and the upload stops. Keep Mac Awake keeps it awake with the lid closed so the upload ends.
- Time Machine
Does Time Machine back up with the MacBook lid closed?
No: Time Machine skips backups while a Mac sleeps, and a closed MacBook sleeps. Keep Mac Awake keeps it awake with the lid closed so a backup can run.
- macOS updates
Can I close my MacBook while it updates?
Not during the install: Apple says not to close the lid. While a macOS update downloads, Keep Mac Awake can keep a closed MacBook awake so it finishes.
- Render and export
Render with the MacBook lid closed
A closed MacBook sleeps, so renders and exports stop, in HandBrake and Blender too. Keep Mac Awake keeps it awake with the lid closed until the job ends.
- Music
How to play music on a MacBook with the lid closed
Close a MacBook and it sleeps, so the music stops. Keep Mac Awake keeps it awake with the lid closed and no display, for speakers, AirPlay or Bluetooth.
- Media server
Run Plex on a MacBook with the lid closed
A closed MacBook sleeps, so Plex and Jellyfin go offline. Keep Mac Awake keeps it awake with the lid closed and no display while the media server runs.
- Home server
Use an old MacBook as a server with the lid closed
An old MacBook makes a home server only while it stays awake. Keep Mac Awake keeps it awake with the lid closed and no display; macOS shares the rest.
- CI runner
Why does my self-hosted GitHub runner on a Mac go offline?
A Mac runner shows Offline when the Mac sleeps, its service waits for a login, or the network drops. Keep Mac Awake keeps a MacBook runner awake.
Compare keep-awake apps
Keep Mac Awake next to the other apps that say they work with the lid closed, each maker's claims dated and linked, plus a note on each app people ask about by name: which keep-awake app to use for AI agents.
- Compare
Which keep-awake app should you use for AI agents on a Mac?
Keep Mac Awake and 29 other ways to keep a Mac awake for AI agents, compared as of November 2026: lid closed, watchdog, heat, battery, agent CLI, price.
- Compare
Amphetamine Power Protect and a closed-lid alternative
Keep Mac Awake is the first choice for a closed MacBook. What Amphetamine Power Protect installs, why Closed-Display Mode needs it, and how to remove it.
- Compare
Amphetamine not working on macOS Tahoe? What to check
Amphetamine stopped keeping your Mac awake on macOS 26? Check Closed-Display Mode, Power Protect, Triggers, battery. Closed lid: Keep Mac Awake first.
- Compare
A KeepingYouAwake and Caffeine alternative for a closed lid
Keep Mac Awake keeps a MacBook awake with the lid closed. KeepingYouAwake and Caffeine keep it awake with the lid open. What each does, as of October 2026.
More guides
Free tools
- Free tool
How do I use caffeinate on a Mac? Command builder
Pick what to keep awake and for how long, and get the exact caffeinate command with each flag explained and what it cannot do. Nothing leaves your browser.
- Free tool
Why did my Mac wake up? pmset -g log, explained
Paste pmset -g log and see every sleep and wake with its reason in plain English: dark wakes, Power Nap, the lid. Nothing leaves your browser.
- Free tool
Why does my MacBook battery drain while sleeping?
Paste pmset -g log and see how much charge your MacBook lost per hour asleep and which dark wakes took the time. Nothing leaves your browser.
- Free tool
How long will my MacBook last with the lid closed?
Estimate how many hours a MacBook runs on battery with the lid closed, from the drain you measure down to the floor you pick. Nothing leaves your browser.
- Free tool
What does pmset -g mean? Mac sleep settings explained
Paste pmset -g to see if your Mac will sleep when idle or with the lid closed, on AC or battery, and what each setting means. Nothing leaves your browser.