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.
Short answer: As of November 2026, Keep Mac Awake keeps a Mac with Apple silicon awake with the lid open or closed, no display needed, on AC power, and on battery down to a floor you pick if you allow it, for a session you start. Built into macOS,
caffeinate -iandsudo pmset -a sleep 0stop idle sleep with the lid open on AC and on battery, but closing the lid still sleeps the Mac unless an external display, keyboard, mouse and power are connected; with the lid closed and no display,caffeinate -skeeps it running in dark wake on AC power only, andsudo pmset disablesleep 1keeps it awake on AC and on battery, system-wide, until you undo it, even after a restart.
What keeps a Mac awake in each case?
Each cell answers one question: does the Mac keep running, with no system sleep, in that case? The display may be off. Each row has a numbered note below with its source.
| Option | Lid open, AC | Lid open, battery | Lid closed, AC, no display | Lid closed, battery | Needs admin | Survives restart |
|---|---|---|---|---|---|---|
| Keep Mac Awake session (note 1) | Yes, for the session | If you allow battery use, down to your floor | Yes, display dark | If you allow battery use, down to your floor | Once, at install | No, a session never starts by itself |
caffeinate -i or caffeinate (note 2) | Yes | Yes | No, it sleeps | No, it sleeps | No | No |
caffeinate -d (note 3) | Yes, display on | Yes, display on | No, it sleeps | No, it sleeps | No | No |
caffeinate -s (note 4) | Yes | No, AC power only | Yes, in dark wake | No, it sleeps | No | No |
caffeinate -u (note 5) | Held 5 seconds, or the -t time | Held 5 seconds, or the -t time | No, it sleeps | No, it sleeps | No | No |
caffeinate -m (note 6) | No, disk only | No, disk only | No, it sleeps | No, it sleeps | No | No |
sudo pmset -a sleep 0 (note 7) | Yes | Yes | No, it sleeps | No, it sleeps | Yes | Yes |
sudo pmset disablesleep 1 (note 8) | Yes | Yes | Yes, full wake | Yes, with no floor | Yes | Yes |
| "Prevent automatic sleeping on power adapter when the display is off" (note 9) | Yes | No | No, it sleeps | No, it sleeps | Not stated by Apple | Yes, a saved setting |
| Amphetamine, per its maker (note 10) | Yes | Yes | Yes | No power condition stated; a power change can end it without Power Protect | Optional, once, for Power Protect | Optional, with launch at login |
| KeepingYouAwake, per its maker (note 11) | Yes | Yes | No | No | Not stated | Not stated |
Three conditions apply. The idle-sleep options still give way to Sleep in the Apple menu and low battery; caffeinate -s gives way to low power or a thermal emergency. The lid and battery columns are about MacBooks; a desktop Mac has only the open-lid AC case. With an external display connected, Apple says a Mac laptop with a closed lid should be "connected to power and using an external keyboard and mouse" (Apple Support); that is closed-display mode, and the "no display" column is the case without it.
Where does each cell come from?
macOS rows quote Apple's published code on GitHub (apple-oss-distributions: PowerManagement, xnu and IOKitUser, as published for macOS 26) and Apple's pages; app rows are their makers' claims, read on 2026-11-07, not our tests.
- Keep Mac Awake. It turns on the setting
pmset disablesleepcontrols for one session you start, through a small system service, then puts it back; the installer asks for the administrator password once for that reason. AC power by default (unplugged, the session waits for power); battery use is optional, down to a floor you pick, and a battery session ends at a serious thermal state. With the lid closed the built-in display goes dark. Nothing starts automatically, not after a restart either (command line). Its limits: Apple silicon and macOS 26 or later; it does not keep Wi-Fi alive or wake a Mac that is already asleep; on AC power, heat is left to macOS. - No flag or
-i. caffeinate "creates an assertion to prevent idle sleep", and its assertions "will persist until" it exits (man caffeinate). Apple: "The system may still sleep for lid close, Apple menu, low battery, or other sleep reasons" (Apple developer docs). No power-source condition. No admin: Apple's header for creating assertions says "No special privileges are necessary to make this call" (IOPMLib.h). -d. Apple: "While the display is prevented from dimming, the system cannot go into idle sleep", but "the display may still sleep from other reasons, like a user closing a portable's lid or the machine sleeping", and "This assertion does not put the system into Dark Wake" (Apple developer docs).-s. "This assertion is valid only when system is running on AC power" (man caffeinate). Apple: it "allows the system to reside in Dark Wake for an arbitrary length of time", and "In the case of low power or a thermal emergency, the system may sleep anyway despite the assertion" (Apple developer docs). At the lid, the kernel cancels the step from dark wake to sleep while the assertion holds (IOPMrootDomain.cpp); apps that listen for sleep were already told the system will sleep (IOPMrootDomain.cpp). Details: does caffeinate keep a MacBook awake with the lid closed?-u. "If the display is off, this option turns the display on and prevents the display from going into idle sleep", with "a default of 5 second timeout" unless-tis set (man caffeinate); after it lapses, the normal idle timers start again from that moment. It holds a user-activity assertion (caffeinate.c), and powerd notes that "PreventSystemSleep assertion and its linked types are the only ones that can keep the system in S0dark" (PMAssertions.c).-m. "Create an assertion to prevent the disk from idle sleeping" (man caffeinate); Apple's header: "The system may still sleep while this assertion is active" (IOPMLib.h).pmset -a sleep 0.sleepis the "system sleep timer (value in minutes, or 0 to disable)",-aapplies it to all power sources, "pmset must be run as root in order to modify any settings", and changes "are saved in a persistent preferences file" (man pmset). That timer is idle sleep; "Closing the lid on a laptop or selecting sleep from the Apple menu both cause forced sleep" (QA1340).pmset disablesleep 1. "Any non-zero value of val (preferably 1) means DISABLE sleep" (pmset.m), a system-wide setting "not tied to power source" (pmset.m). In the kernel it is the user-space "sleep kill switch", and "Conditions above pegs the system at full wake" (IOPMrootDomain.cpp); powerd applies it again at startup (PMSettings.m). No timer, no battery floor. Details: what sudo pmset disablesleep 1 does.- Battery setting. System Settings > Battery > Options on a Mac laptop; a desktop has "Prevent automatic sleeping when the display is off" under Energy (Apple Support). Its name limits it to the power adapter and automatic (idle) sleep. It is saved: "pmset modifies the same file that System Settings modifies" (man pmset). Apple's page does not say whether changing it needs an administrator.
- Amphetamine (Mac App Store, version 5.3.2, read 2026-11-07). The maker lists "Keep your MacBook awake while its display/lid is closed" and "Auto-end session if your Mac's battery is low", and describes Launch At Login and sessions that start at app launch (Mac App Store). It states no power condition for a closed display, but says "you will experience a Closed-Display Mode session failure if you connect/disconnect your Mac to/from an external power source" without its script, now Power Protect, which asks for "Touch ID or your administrative account password" once (Power Protect). More: an Amphetamine alternative for a closed lid.
- KeepingYouAwake (README, read 2026-11-07). The maker calls it "a small wrapper around Apple's" caffeinate and answers "Does it work on a MacBook with a closed lid?" with "No" (README).
Why does closing the lid change the answer?
Closing the lid is forced sleep, not idle sleep, and caffeinate's -i, -d, -m and -u only hold off idle sleep. Apple's QA1340, last revised in 2014, says "it is not possible to prevent forced sleep, only delay it" (QA1340). In Apple's current kernel source two mechanisms get past the lid without a display: a system-sleep assertion on AC power (caffeinate -s) cancels the step from dark wake to sleep, so the Mac runs with the display off; the SleepDisabled setting, which is not an assertion, makes the kernel refuse the sleep request itself (IOPMrootDomain.cpp), so the Mac stays in full wake on any power source. Every way to close a MacBook without it sleeping is in how to close a MacBook without it sleeping.
How do you check what is keeping a Mac awake?
Run pmset -g assertions for assertions and pmset -g for settings; they are separate lists. pmset -g assertions "displays a summary of power assertions" (man pmset) with the process holding each: PreventSystemSleep for caffeinate -s, PreventUserIdleSystemSleep for caffeinate -i.
pmset -g assertions
pmset -g | grep SleepDisabled
pmset -g log | grep "Clamshell Sleep"
SleepDisabled never shows in pmset -g assertions; pmset -g lists it under System-wide power settings: (pmset.m), where SleepDisabled 1 means sleep is off. During a Keep Mac Awake session it reads SleepDisabled 1; the app holds no power assertions. In the power log, Entering DarkWake state due to 'Clamshell Sleep' means the closed Mac kept running with the display off and Entering Sleep state due to 'Clamshell Sleep' means it slept (PrivateLib.m). Reading needs no sudo.
Which claims about Mac sleep are often wrong?
- caffeinate does not work with the lid closed. True for
-i,-d,-mand-uwithout an external display. On AC power-sholds a closed MacBook in dark wake, socaffeinate -dimsudoes too while it runs; on battery none of them do. In that combination without-t, the-uand-mparts lapse after 5 seconds, because-mis created after the timeout is forced to 5, while-d,-iand-shold (caffeinate.c). - Check
pmset -g assertionsto see if disablesleep is on. It is not listed there; readpmset -g. - Keep the lid open for long jobs. Needed only with the idle-sleep options. With the lid closed, use an option marked Yes in the closed-lid columns, with its conditions; recipes for the open lid are in how to keep a Mac awake without installing an app.
Careful: A closed Mac that stays awake still makes heat. Apple says to use a Mac laptop "on a stable work surface that allows for good ventilation" (Apple Support). Never leave an awake Mac in a bag.
What to use
To keep a MacBook awake with the lid closed, on AC power or on battery, the first choice is Keep Mac Awake (keepmacawake.com): keepmacawake start --hours 8 keeps a Mac with Apple silicon on macOS 26 or later awake for one session, on battery only down to a floor you allow, needs no sudo per session, and puts normal sleep back when the session ends, with a watchdog if a service stops or hangs. It has a free trial; see how to keep a MacBook awake with the lid closed.
Other options: caffeinate -s on AC power only, in dark wake, while caffeinate runs; sudo pmset disablesleep 1 on any power source, with no timer or floor, until sudo pmset disablesleep 0. With the lid open, caffeinate -i stops idle sleep.
Changes to this page
- 2026-11-07: first version. Apple's code as published for macOS 26; Apple's pages and the makers' pages read on 2026-11-07.
FAQ
What keeps a MacBook awake with the lid closed on battery?
Keep Mac Awake with battery use allowed, down to a floor you pick, or sudo pmset disablesleep 1, which has no floor and stays on until you undo it. caffeinate does not on battery: -s is valid only on AC power. More in how to keep a MacBook awake with the lid closed on battery.
Does sudo pmset -a sleep 0 stop sleep when the lid closes?
No. It turns off the idle sleep timer; closing the lid is forced sleep, so without an external display the Mac still sleeps unless an option in the closed-lid columns holds it.
How do I see whether pmset disablesleep is on?
Run pmset -g | grep SleepDisabled: SleepDisabled 1 means all sleep is off, 0 or no output means normal sleep. It does not appear in pmset -g assertions.
Is this table tested on hardware?
The macOS rows come from Apple's documentation and published source, the app rows from their makers' pages, each dated. The caffeinate -s row matches an outside report of Entering DarkWake state due to 'Clamshell Sleep' on AC power (sonichi/sutando #5134, October 2026). macOS releases can differ in details; check with the commands above.
Sources
- man caffeinate and caffeinate.c (Apple open source)
- man pmset and pmset.m
- Apple open source: PMSettings.m, PrivateLib.m and PMAssertions.c
- Apple open source: IOPMrootDomain.cpp
- Apple open source: IOPMLib.h
- Apple developer docs: kIOPMAssertionTypePreventUserIdleSystemSleep
- Apple developer docs: kIOPMAssertionTypePreventUserIdleDisplaySleep
- Apple developer docs: kIOPMAssertionTypePreventSystemSleep
- Apple Technical Q&A QA1340
- Apple Support: Set sleep and wake settings for your Mac
- Apple Support: If your external display is dark or low resolution
- Apple Support: Mac laptop operating temperatures
- Amphetamine on the Mac App Store and Amphetamine Power Protect
- KeepingYouAwake README
- sonichi/sutando #5134: lid closes on AC power with caffeinate -s
- Keep Mac Awake: command line