Keep an M5 MacBook Awake With the Lid Closed
Plenty of people buy an M5 MacBook and run it closed on a stand, driving an external monitor. Apple supports that — but only when power and a display are attached, and the moment you want the lid closed without a monitor (a long download, a build, a sync), the Mac sleeps. Here is how to handle both cases.
The built-in way: clamshell mode
macOS runs with the lid closed automatically when all of these are true:
- The MacBook is connected to power.
- An external display is connected.
- A keyboard or mouse is connected (or a Bluetooth one is paired and able to wake it).
Close the lid with those attached and the Mac keeps running on the external screen. This is by design and needs no settings change on an M5 Mac.
The harder case: closed and awake with no display
Want it working with the lid shut and no monitor — finishing a download or a build overnight? macOS has no switch for this in System Settings, because the lid-close sleep is deliberate. The Terminal tool caffeinate holds it awake:
# Prevent sleep until you press Ctrl-C
caffeinate -i
# Stay awake for a fixed two hours (7200 seconds)
caffeinate -i -t 7200
The catch: with the lid physically closed and no display, caffeinate alone may not be enough on every model, and leaving a Terminal window open is fragile. The full picture, including the download and build cases, is in keeping your Mac awake with the lid closed, during a large download, and during a long build.
Why closing the lid sleeps the Mac at all
It is worth understanding, because it explains why there is no simple switch. Closing the lid triggers sleep at the hardware level, not as a preference. macOS overrides that only when it can be confident you are still using the machine — which is what the power-plus-display combination signals. Without a display attached, macOS has no reason to believe anyone is there, so it sleeps. caffeinate works by holding a power assertion that tells macOS a process needs the system awake, which is a different mechanism from the lid switch and why the two do not always combine cleanly.
You can see the assertions currently held on your Mac:
# List what is currently preventing sleep (read-only, changes nothing)
pmset -g assertions
If something is keeping your Mac awake unexpectedly, that command names it.
The external display case in practice
A few things that trip people up running an M5 MacBook closed on a stand:
- Bluetooth peripherals need to be able to wake the Mac. If your keyboard is asleep when you close the lid, the Mac may sleep before the keyboard can announce itself. Tap a key after closing.
- Power matters, not just a cable. A display connected by USB-C that does not deliver power is not enough on its own — the Mac needs to be charging.
- Give it a moment. The display can take a few seconds to pick up after the lid closes. That gap is normal and not a failed connection.
Full monitor setup, including resolution and arrangement, is in external monitor setup.
Putting it back
Nothing above changes a permanent setting. caffeinate stops the moment you close its window or press Ctrl-C, and clamshell mode reverts the instant you unplug. If you changed anything in System Settings while experimenting, set it back the same way — and if you are unsure what you touched, pmset -g prints your current power settings so you can compare against another Mac.
Mainspring keeps your Mac awake with the lid shut as a single labelled toggle, with an undo — no Terminal, no third-party daemon left running.
Try Mainspring free →Signed & notarized by Apple · 1-day free trial · $29 once