Is sudo pmset disablesleep 1 safe? What it does and how to undo it.

By Matyas Rathonyi. Updated November 14, 2026. Guides

sudo pmset -a disablesleep 1 blocks all system sleep, lid close included, on battery too, with no timer or indicator. Undo it with sudo pmset -a disablesleep 0. It is reversible, but not safe to leave on. To keep a MacBook awake with the lid closed without that risk, Clamshell for Mac is a menu bar app that does it only while armed, with no sudo, and normal lid sleep returns when you disarm or quit.

System-wideEvery power source, battery included
No timerOn until you turn it off
UndocumentedMissing from the pmset manual
ReversibleUndo with disablesleep 0

An animated MacBook with a coding agent deploying a website from its terminal. The Option key is held and the lid closes: the display goes black, but the Mac stays awake, so a dimmed copy of the terminal keeps working above the closed laptop while its front edge fills with light. When the deploy is done, a pointer shows how to lift the lid. Opening it wakes the Mac to its lock screen, which unlocks to the finished run: deployed, with the live address. The lid can then be opened and closed freely.

Clamshell for Mac keeps the Mac awake with the lid closed while armed. No sudo, no monitor. Free for 7 days, then $9.99 once.

Apple Silicon, macOS 14+. Notarized by Apple. 3.6 MB. Or install with Homebrew: brew install --cask clamshell. On your phone? Send the Mac download link to yourself.

One switch, still on after you walk away.The flag is not tied to a job or a window. It keeps the Mac awake at the desk, then on battery, then in a bag, until you set it back to 0.

sudo pmset -a disablesleep 1 is reversible, but it is not a safe thing to leave on: it tells macOS not to enter system sleep at all, system-wide, on battery too, with no timer and no menu bar indicator. It does keep a MacBook awake when the lid closes. Undo it with sudo pmset -a disablesleep 0. If you want lid-closed work with nothing to forget, Clamshell for Mac is a menu bar app that does it only while armed, without sudo.

Quick answer

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.

-a, -b or -c?

Other pmset settings can be set per power source: -b for battery, -c for the charger, -a for both. pmset -g reports SleepDisabled as a single value under System-wide power settings, not per power source. Do not count on sudo pmset -c disablesleep 1 or sudo pmset -b disablesleep 1 to limit it to one source; run pmset -g afterwards and treat it as on everywhere while it reads 1.

Most lid-closed menu bar apps flip this same flag through a helper or a sudo rule. The keep-awake mechanisms guide shows which apps do, and what the alternatives are.

Why it needs extra care

A flag you have to remember, or nothing to undo. SleepDisabled stays at 1 after the job ends until you set it back to 0, and you should check pmset -g again after any restart. Clamshell leaves nothing to remember and restores normal lid sleep when you disarm or quit.

How to check whether it is enabled

  1. Check the flag. Run pmset -g and look under the system-wide settings for SleepDisabled:
    pmset -g
    
    # enabled
    SleepDisabled        1
    
    # normal sleep behavior
    SleepDisabled        0
  2. Undo it if it reads 1. Use the specific inverse command:
    sudo pmset -a disablesleep 0
  3. Confirm. Run pmset -g again and confirm that SleepDisabled reads 0. After any restart, check it again before relying on normal sleep.

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. The caffeinate and pmset command builder writes the flags for timed, AC-only and per-process jobs. If the lid must close, use Apple's supported external-display setup, an HDMI dummy plug, or a menu bar app that shows its state and restores normal lid sleep when you disarm or quit.

Clamshell for Mac keeps the Mac awake with the lid closed only while armed and shows the state in the menu bar. An Option-close session ends when the lid opens. No sudo needed.

Apple Silicon, macOS 14+. Notarized by Apple. 3.6 MB. Or install with Homebrew: brew install --cask clamshell. Also on Setapp.

Choose by scope

A one-off open-lid process

Use caffeinate. Its assertion ends with the process.

What caffeinate covers

A closed-lid Mac with no monitor

Compare Clamshell, Amphetamine, pmset, caffeinate, and Apple's display setup.

Compare the options

Not sure yet

Start from every method, with or without a monitor.

Keep a MacBook awake with the lid closed

The Mac will run unplugged

Read how each option behaves on battery first.

Lid closed on battery

The right tool is the one that fits the job and whose off switch you will not forget. Already ran the command? Follow the step-by-step guide to undo sudo pmset disablesleep 1. Using an app instead? See why KeepingYouAwake sleeps when the lid closes and how to fix Amphetamine not working with the lid closed.

Clamshell and pmset side by side

Clamshell for Mac keeps the Mac awake with the lid closed only while armed, with no sudo, and normal lid sleep returns when you disarm or quit.

pmset disablesleep

Free, needs sudo

  • How long: until you run it again with 0, system-wide, on every power source.
  • Restart: treat it as persistent and check pmset -g after any restart.
  • Heat: no thermal cutoff. A workload can continue in a bag with restricted airflow.
  • Battery: a closed Mac can keep doing work until the battery is empty.
  • Permissions: sudo to switch it on and again to switch it off, and no standard menu bar status.

Clamshell

$9.99 once, no sudo

  • How long: only while armed. Option-close and menu bar menu arming cover the next lid close only; right-click and Shortcuts arming last until you disarm.
  • Restart: a restart always returns normal lid-close sleep.
  • Heat: thermal safety is always on. Serious or critical thermal pressure disarms Clamshell toward normal lid sleep and blocks arming until the Mac cools.
  • Battery: a low-battery cutoff at 20%, on by default, lets the Mac sleep before the charge runs out.
  • Permissions: no sudo, no administrator password, no kernel extension or privileged helper.

Frequently asked questions

Is sudo pmset disablesleep 1 safe?

It is reversible, but it is a global, undocumented switch with no timer that also applies on battery. The main risk is forgetting it is on and putting a running Mac in a bag, where it can heat up and drain the battery. Check it with pmset -g and undo it with sudo pmset -a disablesleep 0. To keep a MacBook awake with the lid closed without that risk, Clamshell for Mac is a menu bar app that does it only while armed, with no sudo, shows its state in the menu bar, and returns normal lid sleep when you disarm or quit.

How do I turn pmset disablesleep off?

Run sudo pmset -a disablesleep 0, then run pmset -g and confirm that SleepDisabled reads 0. Avoid sudo pmset restoredefaults unless you want to reset every power setting.

Does pmset disablesleep survive a restart?

Treat it as persistent. It is a system power setting, not a process like caffeinate, so closing Terminal does not undo it. After any restart, run pmset -g and check SleepDisabled before relying on normal sleep.

Can I limit disablesleep to the charger with pmset -c?

Do not count on it. pmset -g reports SleepDisabled as one system-wide value, not per power source. After running any variant, check pmset -g and treat the setting as on everywhere while it reads 1.

Does Clamshell for Mac need sudo or leave anything to undo?

No. Clamshell needs no sudo and leaves nothing to undo: normal lid sleep returns when you disarm or quit, and a restart does the same.

Is there a safer way to keep a MacBook awake with the lid closed?

Apple's supported route is an external display, keyboard, and mouse. Without a display, use a tool that switches off without sudo and shows its state, such as Clamshell for Mac, a menu bar app that restores normal lid sleep when you disarm or quit and disarms on serious thermal pressure.

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. Rechecked October 15, 2026: the macOS pmset(1) manual.