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

By Matyas Rathonyi. Updated October 21, 2026. Guides

Clamshell for Mac keeps a closed Apple Silicon MacBook awake while armed with no admin rights, helper or sudo, and normal lid sleep returns when you disarm or quit. 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, and Amphetamine's Closed-Display Mode according to a user report, since its developer does not document the mechanism); or Apple's closed-display mode with an external display.

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

An animated MacBook with a coding agent deploying a website from its terminal. The Option key is held and the lid closes: the display goes black, but the Mac stays awake, so a dimmed copy of the terminal keeps working above the closed laptop while its front edge fills with light. When the deploy is done, a pointer shows how to lift the lid. Opening it wakes the Mac to its lock screen, which unlocks to the finished run: deployed, with the live address. The lid can then be opened and closed freely.

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.

Apple Silicon, macOS 14+. Notarized by Apple. 3.6 MB. Or install with Homebrew: brew install --cask clamshell.

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 Clamshell keeps it awake with no admin rights. lid closes assertion pmset flag display mode Clamshell
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. Clamshell 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. 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 20 keep-awake tools found the same pattern in Keepresso (a password once per app run, or an optional 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 needs no admin rights and installs nothing privileged. app root Sleep Disabled helper or sudo rule, flag stays set Clamshell lid closed while armed no admin, 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 needs no admin rights, works only while armed and leaves nothing to undo when it stops.

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. 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. An app with no admin step: Clamshell

Clamshell for Mac keeps a closed MacBook awake only while you have it armed, and stops idle sleep from interrupting work in the same session. It needs no sudo, admin password, kernel extension, driver or privileged helper. Three behaviors matter in practice:

Clamshell also arms with an external display connected, so a closed MacBook at a desk stays awake on battery too, without the power, keyboard and mouse Apple's closed-display mode asks for. 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.

Apple Silicon, macOS 14+. Notarized by Apple. 3.6 MB. Or install with Homebrew: brew install --cask clamshell. Also on Setapp.

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 System-wide. pmset disablesleep Needs root. A privileged helper you approve once, or your 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 Not documented. Closed-Display Mode; a user report logs SleepDisabled at 1 Add-on only. App: none. Power Protect add-on: a script plus a configuration file in /private/etc/sudoers.d/, Touch ID or admin password once Not stated Not stated Not stated
Sleepless System-wide. pmset disablesleep sudoers rule, scoped to two pmset commands Off by switch, timer or battery floor; quit and crash not stated README: reboot resets it Not stated
pmset by hand System-wide. sudo pmset -a disablesleep 1 Needs sudo Stays on until you set it to 0 Check pmset -g None
Closed-display mode Extra hardware. macOS, with display, power, keyboard and mouse attached None Nothing to crash; ends when the display is gone Nothing saved macOS only
caffeinate Lid sleeps. Idle-sleep assertion only None Released with the process Nothing saved Lid open use
Keeping​YouAwake Lid sleeps. Wraps caffeinate 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

Two 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.

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: no admin rights, no helper, a restart restores normal lid sleep, 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 keeps the Mac awake with the lid closed while armed and 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 script plus a sudoers file, authorized once with Touch ID or an admin password (Amphetamine's Power Protect add-on). Clamshell for Mac 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 a restart does the same.

How can I tell what is keeping my Mac awake?

Run pmset -g assertions in Terminal to list processes holding power assertions and pmset -g | grep SleepDisabled to see whether the pmset flag is on.

Does Clamshell need sudo or leave anything to undo?

No. Clamshell for Mac needs no sudo, admin password, kernel extension or privileged helper, and there is nothing to undo: normal lid sleep returns when you disarm or quit, and a restart does the same.

Related guides

Sources checked October 8, 2026: Apple's IOPMLib.h header 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. Rechecked October 15, 2026: Keepresso's README, the Amphetamine Power Protect page and App Store listing and Amphetamine issue #19 (a user report).