pmset disablesleep: clamshell mode without an external display
Updated 7 October 2026 · KirsuLab
Every guide to running a MacBook with the lid closed eventually arrives at the same command. This page explains what it does, why it is the only software way through, and how to use it without the usual regret.
The command
sudo pmset -a disablesleep 1
pmset is the power management tool built into macOS. -a applies the setting on battery and on the adapter alike. disablesleep 1 tells the power manager to refuse every request to sleep: idle, lid, the Sleep menu item, all of it. Close the lid and the display goes off but the Mac keeps working.
To undo it:
sudo pmset -a disablesleep 0
To check the current value:
pmset -g | grep disablesleep
The setting is not listed in System Settings and it is not documented in Apple's support pages. It is in the pmset manual, and it works on Apple silicon and Intel alike.
Why nothing else gets through
macOS has two separate sleep triggers.
Idle sleep fires after a period without input. Any app can hold it off with a power assertion. That is what caffeinate, Amphetamine, KeepingYouAwake and Valpas do, and it is all most people need.
Clamshell sleep fires when the lid sensor closes. It sits underneath the assertion system and ignores it. Apple makes one exception: with an external display and the power adapter connected, a closed MacBook stays awake. That is the official clamshell mode, and it is why a cheap HDMI dummy plug is the usual hardware answer.
disablesleep is the switch that turns the clamshell trigger off. There is no assertion that does the same, which is why no sandboxed app and no plain command can do it without root.
What it does to the machine
- Heat. A closed MacBook vents through the hinge, not the keyboard, and a shut lid blocks part of the airflow. Light work, such as a download, a backup or a coding agent waiting on an API, barely warms it. Heavy work, such as a render or a local model on the GPU, does. Hard surface, nothing on top, nothing underneath, never a bed or a bag.
- Battery. The setting applies on battery too. A MacBook with disablesleep on and the adapter unplugged runs until the battery is flat, in a bag if that is where you put it. Use it only on the adapter.
- Wake and lock. The display sleeps as normal. Opening the lid brings it back and asks for a password after whatever delay your Lock Screen settings specify.
- Reboots. The setting survives a restart. Only setting it back to 0, or resetting the power manager, clears it.
The regret
The setting has no timer. People turn it on for one overnight job, forget it, and discover weeks later that the MacBook has never slept since, arriving at the morning meeting hot and at twelve percent. Forgetting the second command is the most common problem with this approach, and the reason to wrap it in something that remembers.
Doing it for one session instead
The cleaner shape is: set disablesleep when a job starts, put it back when the job ends, and also put it back if the adapter is pulled, if the tool quits, or if the Mac gets hot. That is what Valpas does in its direct download. One switch, Keep running with the lid closed, works through a small helper that macOS asks you to allow once in System Settings. Start a session from the menu bar, shut the lid, and the hold ends by itself four ways: when the session ends, when the power adapter is unplugged, when Valpas quits or is not running, and when macOS reports serious thermal pressure. The thermometer in the panel shows that pressure live.
Because the helper needs root, the Mac App Store build cannot have it, so the lid-closed mode lives in the direct download and the Homebrew cask, signed and notarized with an Apple Developer ID. It is free for seven days from the first hold, then a Valpas Pro key, $19.99 once for up to three Macs, keeps it. The App Store build handles the lid-open case only and says so.
If you would rather keep the plain command, that is fine too. Write the undo in the same note as the command, run both on the adapter, and check pmset -g the next morning.
Related
- Keep your Mac awake while an AI agent runs, the overnight Claude Code, Codex and Ollama case.
- caffeinate vs Amphetamine vs Valpas, for the lid-open tools side by side.
Questions & answers
What does pmset disablesleep do?expand_more
It tells the power manager to ignore every reason to sleep, including the lid closing. With sudo pmset -a disablesleep 1 a MacBook keeps running with the lid shut and no display attached. It stays that way until you set it back to 0 or reset the SMC settings. A reboot does not clear it.
Can a MacBook stay awake with the lid closed without an external monitor?expand_more
Not through System Settings. Apple's clamshell mode needs an external display and the power adapter. Without a display the only ways are the hidden pmset disablesleep setting or an app that sets it for you, such as Valpas Pro, which holds it for one session and puts it back.
Does caffeinate work with the lid closed?expand_more
No. caffeinate and apps like Amphetamine hold power assertions, and clamshell sleep ignores assertions. They keep an open MacBook awake and do nothing once the lid shuts.
How do I undo pmset disablesleep?expand_more
Run sudo pmset -a disablesleep 0. Check with pmset -g, which lists the current settings. If you only want to see whether it is on, pmset -g | grep disablesleep prints the value.
Is it safe to leave disablesleep on?expand_more
It is safe for the hardware as long as the Mac is on the adapter and on a hard, open surface. The risk is forgetting it. The Mac will not sleep on battery either, so a closed MacBook in a bag runs flat and hot. Use it for a job and turn it off, or use a tool that turns it off for you.
Does the Mac lock when I close the lid with disablesleep on?expand_more
The display turns off and the usual lock policy applies, so opening the lid asks for a password after the delay you set under Lock Screen. Valpas Pro in Keep display on mode takes the brightness to zero instead of sleeping the panel, so the lid opens without a password.