Preventing Sleep
Also: what is keeping my Mac awake
Quick answer
Preventing Sleep is a column in the Energy tab of Activity Monitor that shows whether an app is currently keeping the Mac from going to sleep. Apps do this on purpose while they play media, download, or run long tasks.
Apps keep a Mac awake by taking a power assertion, a request to macOS to delay sleep. A video player does this while a movie plays, and a backup or download may do it until it finishes. Most apps release the request when they are done.
If your Mac will not sleep on its own, or the display stays on, the Preventing Sleep column is the first place to look.
How to find what is keeping your Mac awake
Open Activity Monitor, click the Energy tab, and click the Preventing Sleep column to sort by it. Apps showing Yes are holding the Mac awake.
For more detail, run pmset -g assertions in Terminal. It lists each active assertion and the process that owns it, which also covers background processes.
What to do about it
If the app has a good reason, such as a download in progress, let it finish. If it does not, quitting the app normally releases the assertion. Browser tabs playing media, including muted ones, are a common cause.
How to read pmset -g assertions
For a one line answer, run pmset -g and look at the sleep line. If something is holding the Mac awake, it ends with the words sleep prevented by and a list of process names.
pmset -g assertions gives the details. The top half is a summary of assertion types, and the section called Listed by owning process shows each process, how long it has held the assertion, and a name the app gave it. The types you will see most:
- PreventUserIdleSystemSleep: the Mac will not sleep on its own, but the display can still turn off.
- PreventUserIdleDisplaySleep: the display stays on. Video players and presentation apps use this.
- PreventSystemSleep: the Mac is kept from sleeping at all. The
caffeinate -sversion of this only works on power. - NoIdleSleepAssertion: another name some apps use when they keep the Mac from idle sleep.
- powerd holding an assertion named Prevent sleep while display is on: normal while you are using the Mac.
When coreaudiod or another system process is keeping your Mac awake
Sometimes the owner in pmset -g assertions is a system process, such as coreaudiod, holding the assertion for another app. In that case the entry has a line that says Created for PID followed by a number. That number is the app you are looking for.
- Run
pmset -g assertionsand find the Created for PID line under the system process. - Run
ps -p <PID> -o comm=, replacing <PID> with that number, to print the app's name. - Stop what that app is doing with audio, such as a paused video, an open call or a recording, or quit the app.
- Run
pmset -g assertionsagain to confirm the entry is gone.
Common reasons a Mac will not sleep
- A browser tab or app with audio or video open, even if it is paused or muted.
- A video call app that still has the microphone or camera open.
- Downloads, uploads, cloud sync and backups that have not finished.
- Apps reading from a disk. Apple gives Music playing songs as an example.
- People using services your Mac shares, such as a connected printer or shared files.
- An active terminal session, such as a remote login. The
pmsetsetting ttyskeepawake prevents idle sleep while one is in use. Runpmset -g | grep ttyskeepawaketo check it, where 1 means on. - A
caffeinatecommand or a keep awake utility you started and forgot about.
How to see what woke your Mac
If your Mac sleeps but wakes up again, the power log records why. Run pmset -g log | grep -e " Sleep " -e " Wake " -e " DarkWake " | tail -20 to see the most recent sleeps and wakes. The text after due to names the cause, such as the lid, a keyboard or trackpad, or a scheduled task.
DarkWake lines are short wakes with the display off, which macOS uses for background tasks. A few of these overnight are normal.
Questions people ask
What does Preventing Sleep mean in Activity Monitor?
It shows whether an app is currently stopping your Mac from sleeping. Yes means the app has asked macOS to stay awake.
How do I see what is preventing my Mac from sleeping?
Check the Preventing Sleep column in the Energy tab of Activity Monitor, or run `pmset -g assertions` in Terminal to see every process holding the Mac awake.
Can I keep my Mac awake on purpose?
Yes. The built in `caffeinate` command keeps the Mac awake while it runs. Press Control-C to stop it.
Why does coreaudiod show up as preventing sleep?
coreaudiod handles sound for every app, so it holds the sleep assertion while an app is playing or recording audio. The Created for PID line in `pmset -g assertions` tells you which app.
Is it bad that powerd is preventing sleep?
No. powerd is the macOS power management process, and its assertion named Prevent sleep while display is on is normal while you use the Mac.
Can a Terminal session keep my Mac awake?
It can. When the ttyskeepawake setting is on, macOS will not idle sleep while a terminal session, such as a remote login, is active. A session counts as inactive once it has been idle longer than the sleep timer. A command run with `caffeinate` also keeps the Mac awake until it finishes.
Related
Looking for something better than Activity Monitor? See the best Activity Monitor alternatives for Mac, or browse every term in the glossary.