Language
November 10, 20264 min read

What pmset disablesleep Does and How to Undo It

Run sudo pmset -a disablesleep 1 to turn sleep off on your Mac. Run sudo pmset -a disablesleep 0 to turn it back on. Nothing resets it for you.

If you leave a Mac awake and want to check on it later, Macky puts its terminal and screen on your iPhone.

What sudo pmset disablesleep 1 does

Run this in Terminal and enter your password:

sudo pmset -a disablesleep 1

Macworld says this prevents sleep in all scenarios until you reverse it. Slack.green adds that it covers a closed lid with no external display.

The -a flag applies the setting to battery and AC power alike.

Check and undo it

Check the current value:

pmset -g | grep SleepDisabled

A result of SleepDisabled 1 means sleep is off. Turn it back on with:

sudo pmset -a disablesleep 0

Closing the Terminal window leaves the value at 1. Third-party sources say it also survives a restart.

For a single job, put both commands on one line so the undo always runs:

sudo pmset -a disablesleep 1; ./long-job.sh; sudo pmset -a disablesleep 0

How it differs from caffeinate

caffeinate and apps like Amphetamine hold power assertions. Closing the lid ignores assertions, so they don't keep a Mac awake in clamshell mode. Our caffeinate guide covers its flags.

MethodWith caffeinateWith pmset disablesleep
MechanismPower assertionSystem power setting
Lid closedMac still sleepsStays awake, per third-party guides
Ends whenThe command or app stopsYou run disablesleep 0
Needs sudoNoYes

Third-party guides call disablesleep undocumented, and we couldn't confirm it from Apple's own pages. For a full lid-closed setup, see keeping a MacBook awake with the lid closed.

Check on it from your iPhone

Macky gives you your Mac's terminal and screen on your iPhone. Closed-lid access works, so you can reach the Mac while it sits shut. Connections are end-to-end encrypted with no open ports.

Macky terminal on iPhone running pmset -g and showing SleepDisabled on a Mac

From your phone, run pmset -g | grep SleepDisabled to see the state. When the job finishes, run sudo pmset -a disablesleep 0 without going back to your desk.

Risks to know about

This setting has no safety net:

  • No timer.
  • No menu bar indicator.
  • No heat cut-off.
  • No battery floor.

Lidrun reports that it keeps the Mac awake at 3% battery or when hot until you turn it off by hand. Don't put the MacBook in a bag while sleep is off. It can get very hot.

When it doesn't stick

If your Mac won't sleep after you set it back to 0, run pmset -g assertions. It lists what is holding sleep off. A display-on assertion is normal while the screen is lit.

On a fresh system, pmset -g may print no SleepDisabled line until the setting has been written once. A missing line means sleep is not disabled.

One GitHub report says that on macOS 26.6.2 on a MacBook Air M2, the value read 1 for about 2 seconds and then went back to 0. Reports on which chips work vary, so test with the lid closed before you rely on it.

FAQ

What does sudo pmset disablesleep 1 do?

It turns off sleep for the whole Mac on both battery and AC power. Third-party guides say it also stops sleep when you close the lid. It stays on until you run sudo pmset -a disablesleep 0.

How do I undo pmset disablesleep?

Run sudo pmset -a disablesleep 0. Then run pmset -g | grep SleepDisabled to confirm the value reads 0.

Does pmset disablesleep survive a restart?

Third-party guides and a GitHub issue say it survives a restart. We couldn't confirm that from Apple's documentation, so check SleepDisabled after you reboot.

How do I see what's stopping my Mac from sleeping?

Run pmset -g assertions in Terminal. It lists the apps and processes that hold power assertions and keep your Mac from idle sleep.

Does caffeinate keep a Mac awake with the lid closed?

No. caffeinate holds a power assertion, and closing the lid ignores assertions. caffeinate -i only stops idle sleep.

Try Macky

Connect to your Mac terminal from your iPhone.