How to keep a MacBook awake with the lid closed
Short answer: with an external monitor, power and a keyboard or mouse attached, macOS does it on its own (closed-display mode). Without a monitor, macOS sleeps when the lid closes, and you need either the undocumented Terminal command sudo pmset -a disablesleep 1 or an app that manages it for you, such as Amphetamine (free, Mac App Store) or Ledge's Keep Awake (free, open source, macOS 26+). caffeinate alone does not survive closing the lid.
The options at a glance
| Method | Needs a monitor? | Cost | Turns itself off? | Notes |
|---|---|---|---|---|
| Closed-display mode (built in) | Yes | Free | n/a | Apple's supported way; needs power and an external keyboard and mouse |
caffeinate | Lid must stay open | Free, built in | When the command ends | Stops idle sleep only |
pmset disablesleep 1 | No | Free, built in | No, until you undo it | Undocumented; easy to forget |
| Amphetamine | No | Free | Yes, sessions and triggers | Mac App Store; Closed-Display Mode asks you to install a helper script |
| Ledge Keep Awake | No | Free, GPL-3.0 | Yes, at a time you set; a 90-second lease if Ledge quits | macOS 26+, notched MacBooks; root helper installed only when enabled |
1. With an external monitor: closed-display mode
If the MacBook is connected to a display, macOS keeps running after you close the lid. Apple's troubleshooting page says that for a Mac laptop with a closed lid, "make sure that the Mac is connected to power and using an external keyboard and mouse." No software is needed.
2. Without a monitor: pmset disablesleep
sudo pmset -a disablesleep 1 # stay awake, lid closed or not
sudo pmset -a disablesleep 0 # back to normal
This works and costs nothing, but it is not in Apple's pmset manual, and it stays on until you turn it off. The usual way it goes wrong is a Mac that keeps running in a closed bag. While it is set, the built-in screen and keyboard light can also stay lit behind the closed lid, draining the battery.
3. Amphetamine
Amphetamine by William Gustafson is a long-running, free keep-awake app on the Mac App Store with no in-app purchases. It lists "Keep your MacBook awake while its display/lid is closed" as a feature, and since version 5.3 its Closed-Display Mode asks you to install a small script. It has far more options than Ledge (triggers for apps, Wi-Fi, displays, schedules). As of this writing its App Store page shows the latest version as 5.3.2 from November 2023.
Choose it if you want rich automation, support for older macOS versions, or an app from the App Store.
4. Ledge's Keep Awake
Ledge is my notch app for MacBooks. Its Keep Awake feature is off by default; once enabled in Settings, it has stops for keeping the Mac awake with the lid open (like caffeinate) and with the lid closed. The lid-closed stop uses the same pmset setting as above, held by a helper that runs as root, which is installed only when you turn the stop on and removed when you turn it off. While the lid is shut it quiets the screen, keyboard light and speakers, and it lets go at the time you set.
The part I care about most: the hold is a 90-second lease that Ledge keeps renewing. If Ledge crashes, is force-quit or updates mid-hold, the lease runs out and the Mac is allowed to sleep again, with nothing to undo by hand.
Choose it if you have a notched MacBook on macOS 26 and already want a notch app, or want to read the source of the thing holding your Mac awake. Do not choose it for older macOS or Macs without a notch; it will not run there.
FAQ
Can a MacBook stay awake with the lid closed without an external monitor?
Not with Apple's built-in settings. You need pmset disablesleep or a third-party app such as Amphetamine or Ledge.
Is it safe to run a MacBook with the lid closed?
On a desk, generally yes. The risk is a closed Mac left awake in a bag, where it can get hot and drain its battery. Use a tool that releases the hold automatically, or set a time limit.
Does caffeinate keep a Mac awake with the lid closed?
No. It prevents idle sleep while the lid is open. Closing the lid without an external display still puts the Mac to sleep.
How do I undo pmset disablesleep?
Run sudo pmset -a disablesleep 0. The setting stays on until you do.
Related
- Keep-awake apps for Mac compared
- Best notch apps for MacBook in 2026
- Ledge: a free, open-source notch app for MacBook
Sources
- Apple Support, If your external display is dark or low resolution
- Amphetamine on the Mac App Store
- Ledge README (Keep Awake) and what it reaches for (the root helper and its lease)