How do keep-awake apps keep a closed MacBook awake?

By Matyas Rathonyi. Updated October 8, 2026. Guides

Clamshell for Mac keeps a closed Apple Silicon MacBook awake with the IOKit lid sleep-state control, which needs no admin rights, helper or sudo. Every other tool uses one of three routes: an idle-sleep power assertion (caffeinate, KeepingYouAwake), which cannot stop lid sleep; the root-only pmset disablesleep flag (LidRun, Sleepless, Amphetamine's Closed-Display Mode by user reports); or Apple's closed-display mode with an external display.

AssertionIdle sleep only
pmset flagRoot, system-wide
Display modeNeeds a monitor
IOKit lidNo admin rights

Clamshell for Mac keeps a MacBook awake with the lid closed while armed, with no helper, no sudo and no external display. Free for 7 days.

Download free trial

Apple Silicon, macOS 14+. Notarized by Apple. 3.6 MB. Or buy now, $9.99

A MacBook lid closes. Four mechanisms respond: a power assertion lets it sleep, the pmset flag keeps it awake but needs root, closed-display mode keeps it awake with a monitor, and the IOKit lid control keeps it awake with no admin rights. lid closes assertion pmset flag display mode IOKit lid
One lid close, four answers.An assertion lets the Mac sleep (red). The pmset flag keeps it awake but needs root (amber). Closed-display mode needs a monitor. The IOKit lid control keeps it awake with no admin rights.

Search for a way to keep a MacBook awake with the lid closed and you get a long list of menu bar apps that look interchangeable. Under the hood there are only four mechanisms, and the one an app uses decides almost everything that matters: whether it works with the lid shut, whether it asks for an administrator password, what stays switched on if the app quits or crashes, and whether a restart clears it. This guide explains each mechanism from Apple's own headers and manuals, says which apps use which according to their developers, and shows the Terminal commands that tell you what is holding your Mac awake right now.

Idle sleep and lid sleep are different

macOS has two separate reasons to put a MacBook to sleep. Idle sleep happens when nobody touches the Mac for the time set in System Settings. Lid sleep happens when you close the lid with no external display attached. The macOS power manager publishes the second one as a registry value: AppleClamshellCausesSleep, which Apple's IOPM.h header describes as true when the system will sleep on lid close and false when it will not, "typically external display mode". Every keep-awake mechanism stops idle sleep. Only some of them stop lid sleep.

1. Power assertions: caffeinate, KeepingYouAwake

A power assertion is a request a process makes to the power manager: do not idle sleep while I hold this. caffeinate is Apple's command-line front end for it. caffeinate -i make, an example from its manual, holds an assertion that prevents idle sleep as long as make runs. KeepingYouAwake describes itself as a small wrapper around caffeinate, and Claude Code runs caffeinate during a session for the same reason.

The limit is written into Apple's own header. The documentation for kIOPMAssertPreventUserIdleSystemSleep in IOPMLib.h says the system may not idle sleep while it is held, but "may still sleep for lid close, Apple menu, low battery, or other sleep reasons." That is why caffeinate and the apps built on it stop working the moment you close the lid. KeepingYouAwake's README says so plainly: it only prevents sleep on desktop Macs and laptops with an open lid. The caffeinate guide covers each flag.

The upside is cleanup. An assertion belongs to the process that created it. We started caffeinate -i, confirmed its assertion in pmset -g assertions, killed it with kill -9, and the assertion was gone a second later. Nothing is left behind, so these tools are a safe choice whenever the lid stays open.

2. The pmset disablesleep flag: LidRun, Sleepless, Amphetamine

sudo pmset -a disablesleep 1 sets a system-wide value that pmset -g reports as SleepDisabled 1. While it is on, the Mac does not enter system sleep at all, lid close included, on battery too. It is the most common lid-closed mechanism, and it has three properties to understand:

Apps handle the root requirement in different ways, according to their own pages:

Our roundup of 15 keep-awake apps found the same pattern in Keepresso (an admin helper approved once) and Adrafinil (a small root helper).

Two paths to a closed-lid session. A typical app goes through a root helper or sudo rule to flip the system-wide SleepDisabled flag. Clamshell talks to the power manager directly, as a normal user. app root Sleep Disabled helper or sudo rule, flag stays set Clamshell lid control normal user, no helper
Where the privilege goes. The pmset route needs root, so apps add a helper, a sudo rule or a password prompt, and the flag they set outlives the app. Clamshell calls the power manager's lid control as a normal user while armed.

3. Apple's closed-display mode

Apple's own way to use a MacBook with the lid closed is closed-display mode, often called clamshell mode. Apple's support pages say the Mac needs to be connected to power and using an external display, keyboard and mouse. When those are attached, macOS sets AppleClamshellCausesSleep to false on its own. Nothing is installed and no admin rights are needed, but the Mac goes back to normal lid sleep once the display is gone. An HDMI dummy plug imitates a display to get the same result. The clamshell mode guide compares the workarounds.

4. The IOKit lid sleep-state control: Clamshell

The power manager in macOS, IOPMrootDomain, accepts a call that sets whether closing the lid causes sleep. Its selector, kPMSetClamshellSleepState, is defined in the public macOS SDK header IOPMLibDefs.h, and a normal user process can make the call. Apple does not document its behavior beyond that definition, so treat it as an unsupported interface, the same way you would treat the undocumented disablesleep setting.

Clamshell for Mac uses this control while armed, together with a PreventUserIdleSystemSleep assertion so idle sleep does not interrupt work. That combination is why it needs no sudo, admin password, kernel extension, driver or privileged helper, and why it never touches SleepDisabled. Two details follow from the mechanism:

Clamshell also pauses instead of arming while an external display is connected, because Apple's closed-display mode already covers that case. The what is Clamshell guide covers the rest.

What is left behind after a quit or crash?

This is where the mechanisms differ most, and where most reviews say nothing. A forgotten sleep switch is how a MacBook ends up hot in a backpack.

An app holding a power assertion crashes. The assertion goes away with it and the closed Mac sleeps normally. app exits z Assertion released with it An app that set the pmset flag crashes. SleepDisabled stays at 1 and the closed Mac stays awake until something resets it. app exits SleepDisabled 1 stays until reset
Same crash, different leftovers. An assertion dies with its process, so the Mac sleeps again. The pmset flag is a setting, not a request, so it stays on until a helper, the next launch or you set it back to 0.

Clamshell keeps a closed MacBook awake with no helper and nothing left switched on, with thermal safety always on. Free for 7 days, then $9.99 once for one Mac. 14-day money-back guarantee.

Download free trial

Keep-awake tools by mechanism (October 2026)

Each cell comes from the tool's own website, README, help center or manual, checked October 8, 2026. Where a developer does not say, the cell says so.

ToolMechanismAdmin or helperAfter quit or crashRestartThermal
LidRun Pro pmset disablesleep Privileged helper approved once, or an admin password each time Sets it back to 0 on quit; helper restores sleep after an unexpected quit; without it, reset on next launch Not stated Can step back at serious or critical
Amphetamine Closed-Display Mode, not documented; a user report logs SleepDisabled at 1 App: none. Power Protect add-on: sudoers file, admin once Not stated Not stated Not stated
Sleepless pmset disablesleep Scoped sudoers rule for two pmset commands Off by switch, timer or battery floor; quit and crash not stated README: reboot resets it No limit stated
pmset by hand sudo pmset -a disablesleep 1 sudo Stays on until you set it to 0 Check pmset -g None
Closed-display mode macOS, with display, power, keyboard and mouse attached None Nothing to crash; ends when the display is gone Nothing saved macOS only
caffeinate Idle-sleep assertion; the lid still sleeps None Released with the process Nothing saved Lid open use
Keeping​YouAwake Wraps caffeinate; the lid still sleeps None Released with caffeinate Nothing saved Lid open use

Where the others are better: LidRun adds process auto-detection and supports Intel Macs, Sleepless is free and fits in one auditable file, Amphetamine is free with many triggers, and caffeinate and KeepingYouAwake are free and leave nothing behind when the lid stays open. Clamshell needs Apple Silicon and macOS 14 or later, and costs $9.99 once after the trial.

How to check what is keeping your Mac awake

Three read-only Terminal commands show which mechanism is active, whatever app you use:

  1. List assertions. pmset -g assertions shows every process holding a power assertion, including caffeinate and keep-awake apps. These only block idle sleep.
  2. Check the pmset flag. pmset -g | grep SleepDisabled prints SleepDisabled 1 while the flag is on. If nothing should be running, sudo pmset -a disablesleep 0 turns it off; the undo guide has the full check.
  3. Check the lid policy. ioreg -r -k AppleClamshellCausesSleep -d 1 prints "AppleClamshellCausesSleep" = Yes on a laptop that will sleep on lid close, and No in closed-display mode. Clamshell's own state is its menu bar icon, or the Clamshell Status action in Shortcuts.

Which mechanism fits your job?

The lid stays open

Use an assertion: caffeinate, KeepingYouAwake or Amphetamine. Free, nothing left behind.

A monitor is on your desk

Apple's closed-display mode. Nothing to install.

Lid closed, no monitor, no admin

Clamshell for Mac: the IOKit lid control, no helper, never saved across a restart, thermal safety always on.

Try Clamshell free

You want pmset, deliberately

Use an app with its own cleanup, or run it by hand and check SleepDisabled before the Mac goes in a bag.

Frequently asked questions

How do keep-awake apps keep a Mac awake with the lid closed?

They use one of three routes. Most switch the system-wide SleepDisabled flag that sudo pmset disablesleep 1 sets, which needs root, so the app adds a privileged helper or a sudo rule. Apple's closed-display mode keeps the Mac awake while an external display, power, keyboard and mouse are attached. Clamshell for Mac uses the IOKit lid sleep-state control, which needs no admin rights. Idle-sleep power assertions, which caffeinate creates, do not stop lid sleep.

Why does caffeinate not work with the lid closed?

caffeinate creates power assertions. Apple's IOKit header says the PreventUserIdleSystemSleep assertion stops idle sleep, but the system may still sleep for lid close, the Apple menu, low battery or other reasons. Closing the lid is a separate sleep path that an assertion does not block.

Why do some keep-awake apps ask for an admin password or install a helper?

Changing the SleepDisabled flag with pmset disablesleep needs root. Apps that use it either ask for an administrator password each time, install a privileged helper once (LidRun), add a scoped sudoers rule (Sleepless), or install a sudoers file (Amphetamine's Power Protect add-on). Clamshell for Mac does not use that flag and needs no admin rights.

What happens if a keep-awake app crashes?

It depends on the mechanism. A power assertion is released when its process exits. The pmset SleepDisabled flag stays on until something sets it back to 0, so apps that use it need their own cleanup: LidRun says its helper restores sleep if the app quits unexpectedly. Clamshell's direct edition relaunches after an unexpected exit when its crash-recovery agent is permitted and restores normal lid sleep on startup, and its lid change is never saved across a restart.

How can I tell what is keeping my Mac awake?

Run pmset -g assertions in Terminal to list processes holding power assertions, pmset -g | grep SleepDisabled to see whether the pmset flag is on, and ioreg -r -k AppleClamshellCausesSleep -d 1 to see whether macOS reports that closing the lid causes sleep, which reads No in closed-display mode.

Does Clamshell use pmset disablesleep?

No. Clamshell for Mac never changes SleepDisabled. While armed it uses the unprivileged IOKit lid sleep-state control on IOPMrootDomain plus a PreventUserIdleSystemSleep assertion, with no sudo, admin password, kernel extension or privileged helper.

Related guides

Sources checked October 8, 2026: Apple's IOPMLib.h, IOPM.h and IOPMLibDefs.h headers in the macOS SDK; the caffeinate(8) and pmset(1) manuals; Apple's support pages on a closed laptop with an external display and accessories with the lid closed; KeepingYouAwake's README; LidRun's help center and its pmset alternative post; Sleepless's README; Amphetamine's Power Protect page and GitHub issue #19. The assertion cleanup test was run on an Apple Silicon MacBook on October 8, 2026. Clamshell behavior is described from its changelog and FAQ. Clamshell is the publisher of this guide and an independent app, not affiliated with or endorsed by Apple. Product names belong to their respective owners.