pmset disablesleep: Keep a Mac Awake With the Lid Closed, and Undo It
sudo pmset -a disablesleep 1 stops all system sleep on a Mac, lid closed included, and sudo pmset -a disablesleep 0 turns normal sleep back on. How to check whether it is on, why it outlives a restart, and the pmset and caffeinate commands to use instead.
Reading on your phone?
Build the command on your Mac
The caffeinate command runs in Terminal on your Mac. Send yourself this page and build it there.
On this page
sudo pmset -a disablesleep 1 tells macOS never to enter system sleep, and that includes closing the lid of a MacBook with no external display. sudo pmset -a disablesleep 0 turns normal sleep back on at once. The setting needs an admin password, has no timer and no menu bar icon, and stays on after a restart. It is also missing from Apple's pmset manual page, though the pmset program on macOS 26.5.2 still contains it (output below). Check it with pmset -g, or without any password with ioreg, and undo it as soon as the job is done. If the reason you want the Mac awake is to keep your Slack dot green, this command will not do it. The Slack desktop app sets you to away after 10 minutes without keyboard or mouse input on the Mac, even when the Mac never sleeps (Slack desktop 4.52.178 code, checked 7 Oct 2026). Slack Green keeps the dot green from a server instead, so the Mac can sleep with the lid shut, free for 7 days with no card.
The commands
sudo pmset -a disablesleep 1 # never sleep, lid closed included
sudo pmset -a disablesleep 0 # normal sleep again
pmset -g # check: look for SleepDisabled
sudo is needed because the change applies to the whole system, not to your user. The -a flag means all power sources (battery, charger and UPS). For disablesleep it makes no practical difference, because the flag is a single system-wide value rather than a per-power-source setting. Guides that write sudo pmset disablesleep 1 without -a set the same thing.
Nothing else changes. The display still turns off on its own timer, the screen still locks on its own timer, and closing the lid still turns off the built-in display. The CPU, network and disks keep running.
What we found on macOS 26.5.2
We checked a MacBook Pro (M2 Max, macOS 26.5.2, build 25F84) on 4 October 2026. None of these checks needs an admin password.
The manual does not know the word, but the program does:
$ man pmset | col -b | grep -ci disablesleep
0
$ strings /usr/bin/pmset | grep -n -E "disablesleep|SleepDisabled"
179:SleepDisabled
180: SleepDisabled
578:disablesleep
pmset -g cap lists the settings a Mac stores per power source. disablesleep is not among them, which is why it is one system-wide switch and -a, -b or -c make no difference:
$ pmset -g cap
Capabilities for AC Power:
displaysleep
disksleep
sleep
womp
standby
powernap
ttyskeepawake
hibernatemode
hibernatefile
tcpkeepalive
lowpowermode
The power manager in the kernel reports the current value, so you can check it without sudo:
$ ioreg -r -c IOPMrootDomain | grep SleepDisabled
| "SleepDisabled" = No
Yes means disablesleep 1 is on. Our Mac said No, and its pmset -g System-wide section was empty.
pmset -g also names whatever is keeping the Mac awake right now. On our Mac, Amphetamine was running:
$ pmset -g
System-wide power settings:
Currently in use:
...
sleep 1 (sleep prevented by Amphetamine, powerd)
displaysleep 10 (display sleep prevented by Amphetamine, Aside)
If a Mac does not sleep and this line shows no app, check SleepDisabled next.
pmset disablesleep keeps the Mac awake, even with the lid closed, but Slack still sets you away 10 minutes after your last keyboard or mouse input. A server-side tool keeps your Slack dot green with no input, even while the laptop sleeps or the lid is closed.
How to check whether disablesleep is on
Run pmset -g in Terminal. When the setting is on, the first section lists it:
System-wide power settings:
SleepDisabled 1
Currently in use:
...
SleepDisabled 1 means sleep is off. SleepDisabled 0 means normal sleep. On a Mac where nobody ever set it, the line can be missing entirely, as on our test Mac. The ioreg line above gives the same answer as Yes or No.
The System-wide section reads /Library/Preferences/com.apple.PowerManagement.plist, under SystemPowerSettings, which is why the setting survives a restart. On our Mac that dictionary held one unrelated key (Update DarkWakeBG Setting) and no SleepDisabled. A Mac that stopped sleeping weeks ago, with no app running, is worth checking for this line first. Other causes, from Power Nap to apps that hold sleep assertions, are in why is my Mac not going to sleep.
pmset -g assertions answers a different question. It lists the running processes that are holding the Mac awake right now, such as caffeinate or Amphetamine. disablesleep does not show there, because it is a setting, not a process.
How to undo it
- Run
sudo pmset -a disablesleep 0and enter your password. - Run
pmset -gand confirm the line readsSleepDisabled 0. - Close the lid to test. The Mac should sleep within a few seconds.
- •
pmset sleep 0sets the idle sleep timer to never. It is in the manual ("0 to disable"), but it only stops idle sleep. Closing the lid still puts the Mac to sleep. Use-cinstead of-ato apply it on the charger only. - •
pmset noidleholds an assertion while it runs and needs no admin rights. We ran it on macOS 26.5.2 andpmset -g assertionsshowedpid 49529(pmset): NoIdleSleepAssertion named: "pmset prevent sleep"until we stopped it.caffeinate -i -t 4showed up the same way, asPreventUserIdleSystemSleep named: "caffeinate command-line tool", for 4 seconds. The manual marks it deprecated in favor ofcaffeinate. - •
caffeinateis the supported tool for keeping the Mac awake for one job or one stretch of time, and it ends by itself. Every flag, with timers and examples, is in caffeinate on Mac. - • Heat. A closed MacBook that keeps working in a bag or on a bed has little airflow. Keep it on a hard surface.
- • Battery. The setting also applies on battery, so a closed Mac can run until the battery is empty.
- • Forgetting. There is no indicator. Put the undo command in the same terminal line as the job:
sudo pmset -a disablesleep 1; ./long-job.sh; sudo pmset -a disablesleep 0. - • Undocumented. Apple does not list
disablesleepinpmset(1), so a macOS update could change it without notice.
There is no need to restart. Avoid sudo pmset restoredefaults as a first fix: it resets every power setting as a group, including display sleep times and Power Nap choices you made on purpose. Use it only if pmset -g shows other values you cannot explain.
pmset disablesleep vs sleep 0, noidle and caffeinate
| Command | Admin rights | Lid closed | Ends when |
|---|---|---|---|
sudo pmset -a disablesleep 1 | Yes | Stays awake | You run disablesleep 0 |
sudo pmset -a sleep 0 | Yes | Sleeps | You set a sleep time again |
pmset noidle | No | Sleeps | You press Ctrl-C |
caffeinate -i | No | Sleeps | The command or timer ends |
Only disablesleep covers a closed lid with no external display. With a display, keyboard and power connected, macOS supports lid-closed use on its own (clamshell mode), and that needs no command. Both setups are compared in how to keep a laptop awake with the lid closed.
When to use it, and the risks
disablesleep fits a Mac that has to keep a download, a render, a backup or a server running with the lid shut and no display attached. For everything else a timed command or an app is safer.
If you want a menu bar switch instead of Terminal, Amphetamine has a closed-display mode with its own helper. How it compares with KeepingYouAwake is in KeepingYouAwake vs Amphetamine, and the wider list is in best app to keep a Mac awake.
Does disablesleep keep Slack or Teams active?
No. A Mac that never sleeps still has an idle user. Slack sets you to away after 10 minutes with no keyboard or mouse input, and Teams after about 5 minutes of inactivity, whatever the power settings say. The same test for the popular apps is in does Amphetamine keep Slack active, and the options that do work on a Mac are in keep Slack active on Mac.
FAQ
Can I check disablesleep without sudo?
Yes. Run ioreg -r -c IOPMrootDomain | grep SleepDisabled. Yes means sleep is disabled, No means normal sleep.
Does disablesleep stop the screen from turning off?
No. The display still sleeps on its displaysleep timer and the screen still locks. Only system sleep stops.
Related Articles
Mac Keeps Going to Sleep? Find the Reason, Then Fix the Timer
A Mac that keeps going to sleep usually has a short display timer: when the display turns off, the Mac sleeps about a minute later. On battery the default can be 2 minutes. How to read the exact reason in pmset -g log, the System Settings that control it, and Terminal commands for when you need the Mac awake.
Why Is My Mac Not Going to Sleep? Find the Cause in One Command
Run pmset -g in Terminal. The sleep line names every app that is keeping your Mac awake right now, such as a browser tab playing audio, a Zoom call or Amphetamine. How to read it, the settings that keep a Mac awake on purpose, and how to find what wakes a sleeping Mac at night.
How to Change Sleep Settings on a Mac (Ventura to Tahoe)
On macOS Ventura and newer, the Mac's sleep timer is its display timer: set it in System Settings > Lock Screen, under Turn display off on battery and on power adapter when inactive. The Mac sleeps about a minute after the display turns off, unless you turn on Prevent automatic sleeping in Battery > Options, or in Energy on a desktop Mac. Every setting, where it lives by macOS version, and the pmset commands.