What pmset disablesleep does on a Mac.

Written and tested by Matyas Rathonyi on July 12, 2026. Guides

sudo pmset -a disablesleep 1 tells macOS not to enter system sleep. It can keep a MacBook awake when the lid closes, but it is a broad system-wide switch with no built-in timer or obvious menu bar indicator. If you use it, know how to check and turn it off before the Mac goes into a bag.

The command and its inverse

sudo pmset -a disablesleep 1

# restore normal sleep behavior
sudo pmset -a disablesleep 0

sudo is required because pmset changes system power settings. The -a flag applies a setting to all power sources, including battery and wall power. Unlike a temporary caffeinate process, the flag is not tied to one Terminal window or one job. Leave it at 1 and closing that window does not restore normal sleep.

Why it needs extra care

How to check whether it is enabled

Run pmset -g and look under the system-wide settings for SleepDisabled:

pmset -g

# enabled
SleepDisabled        1

# normal sleep behavior
SleepDisabled        0

pmset -g assertions is a different diagnostic. It lists temporary assertions owned by running processes, such as caffeinate. The SleepDisabled system flag is the relevant check for this command.

Do not reach for restoredefaults first

sudo pmset restoredefaults exists, but it resets power management settings as a group. That is much broader than undoing one change and can wipe intentional settings. Use the specific inverse command first:

sudo pmset -a disablesleep 0

Safer choices for common jobs

If the lid stays open, use caffeinate -i your-command. Its assertion ends with the process. If the lid must close, use Apple's supported external-display setup, an HDMI dummy plug, or a purpose-built session control that exposes its state and restores normal lid sleep automatically.

Clamshell changes lid-close behavior only while armed, shows the state in the menu bar, and disarms on lid open. No sudo or persistent power preference.

Download free trial

Choose by scope

For a one-off open-lid process, use caffeinate. For a closed-lid Mac with no monitor, compare all the options in the clamshell-mode guide. The right tool is the one whose scope matches the job and whose off switch you will not forget.

Method: checked against the macOS pmset(1) manual and current behavior on an Apple Silicon MacBook. Because disablesleep is undocumented, treat it as implementation detail rather than a stable Apple interface.