Guides/Why won’t my Mac sleep

Why won’t my Mac sleep? How to find what is keeping it awake

Atta 🐬

Founder, Vitals

Published

Quick answer

Open Terminal and run `pmset -g assertions`. Under “Listed by owning process”, each line names an app that is holding sleep off, for how long, and the reason it gave. Activity Monitor marks the same apps Yes in the Energy tab’s Preventing Sleep column. The usual causes are a video or call left open in a browser tab, a download or backup, a `caffeinate` command still running, and settings that keep the Mac awake on power. On a MacBook, the Vitals system monitor lists these apps without Terminal, on its Battery tab and in the menu bar, with the reason and how long.

How to find what is keeping your Mac awake

  1. 01 Open Terminal and run pmset -g | grep sleep. If something is holding sleep off, the sleep line ends with a note such as (sleep prevented by Google Chrome, powerd).
  2. 02 Run pmset -g assertions for the detail. Under “Listed by owning process”, each line gives the app and its PID, how long it has held sleep off, the type of hold, and after the word named, the reason it gave, such as "Video Wake Lock".
  3. 03 Ignore powerd’s "Prevent sleep while display is on" and the UserIsActive lines. They only mean you are using the Mac, and go away when you stop.
  4. 04 Open Activity Monitor, click Energy, and look at the Preventing Sleep column. Yes marks the same apps, and you can quit one from there.
  5. 05 Quit the app, or close what it is doing: the tab playing video, the call, the download. Run pmset -g assertions again to check the line has gone.

A Mac that sleeps but keeps waking up is a different problem, with its own log. See "When the Mac wakes up by itself" below.

A Mac sleeps when nothing asks it not to. Apps ask by creating a power assertion: a request macOS records with the app’s name and its reason. A video player, a call, a download or a backup asks for good reason. The trouble starts when the request outlives the reason: a tab playing a muted video, a call that ended in another tab, a caffeinate in a terminal window you forgot. The table below matches what you see to the likely cause and where to look.

Why a Mac stays awake

What you noticeLikely causeWhere to check
The screen never turns off An app holding the display on: a video, a call, a presentation pmset -g assertions: PreventUserIdleDisplaySleep
The screen turns off but the Mac never sleeps A download, a backup, a sync or a build holding the system awake pmset -g assertions: PreventUserIdleSystemSleep
It never sleeps while plugged in A setting that keeps it awake on power System Settings → Battery → Options, or Energy on a desktop
It sleeps, then wakes on its own at night Scheduled maintenance, the network, or a connected device pmset -g log, and pmset -g sched
It stays awake after you ran a Terminal command `caffeinate` still running Activity Monitor: search for caffeinate
It stays awake while other devices use its connection Internet Sharing System Settings → General → Sharing

What the assertion types mean

Each line in pmset -g assertions names a type. Three of them keep the Mac awake. The rest are bookkeeping, and seeing them is normal.

  • PreventUserIdleDisplaySleep, or NoDisplaySleepAssertion: keeps the screen on, and the Mac with it. Video players, video calls and presentations use it.
  • PreventUserIdleSystemSleep, or NoIdleSleepAssertion: keeps the Mac awake while the screen is free to turn off. Downloads, backups, music playing and builds use it.
  • PreventSystemSleep: keeps the Mac awake even with the lid closed on power. Rare; usually a system service.
  • UserIsActive, BackgroundTask and ApplePushServiceTask: bookkeeping that does not hold sleep off by itself.

When the Mac wakes up by itself

A Mac that went to sleep can still wake briefly on its own, with the screen off, to check mail, sync, back up or run maintenance. macOS calls this a dark wake. A few a night are normal. Dozens, or full wakes with the screen on, point at a device or a setting.

  1. Run pmset -g log | grep -E "Wake from|DarkWake from" | tail -20 to see the last 20 wakes. The text after “due to” names the cause: lid means you opened it, rtc/Maintenance is a scheduled maintenance wake, and names of USB, Bluetooth or network devices point at that device.
  2. Run pmset -g sched to see wakes macOS has scheduled for later, and which part of the system asked for each.
  3. If a device is waking the Mac, unplug it overnight and see whether the wakes stop.
  4. If network wakes are the cause, set Wake for network access to Only on Power Adapter or Never, in System Settings → Battery → Options on a MacBook or System Settings → Energy on a desktop Mac.

Settings that keep a Mac awake on purpose

Some settings keep a Mac awake by design. Check them before you look for a misbehaving app.

  • On a MacBook, Prevent automatic sleeping on power adapter when the display is off, in System Settings → Battery → Options.
  • On a desktop Mac, Prevent automatic sleeping when the display is off, in System Settings → Energy.
  • Internet Sharing, in System Settings → General → Sharing, which keeps the Mac awake while other devices use its connection.
  • Display sleep set to Never in System Settings → Lock Screen, which keeps the screen on and the Mac awake with it.

caffeinate, and apps that keep a Mac awake on request

caffeinate is the macOS command that keeps a Mac awake for as long as it runs. Scripts and developer tools use it, and so do keep-awake menu bar apps. It shows in pmset -g assertions under its own name, and in Activity Monitor as caffeinate.

If you started it, press Control-C in its Terminal window. If you did not, find which app started it: in Activity Monitor, choose View → All Processes, Hierarchically and look for caffeinate under its parent. Quitting the parent stops it.

What Vitals adds

On a MacBook, Vitals names the apps keeping it awake, in plain words, without Terminal.

  • Keeping This Mac Awake, on the Battery tab: each app with the reason it gave, such as Playing video or Downloading, how long it has held sleep off, and whether it keeps the screen on
  • The same list in the Battery section of the menu bar dropdown while an app is holding sleep off, so you can check before you close the lid
  • A browser is one line however many tabs are playing, and a caffeinate left in a terminal shows as Asked to stay awake
  • Free to Sleep when nothing is holding it

Good to know

  • The list is on MacBooks only. On a Mac mini, iMac, Mac Studio or Mac Pro, use pmset -g assertions.
  • It leaves out macOS’s own processes, such as powerd, WindowServer and sharingd during Handoff, which hold sleep off for moments at a time. pmset -g assertions shows everything.
  • Vitals does not show wake history. pmset -g log does.
Get Vitals for $9 $9 during the launch, $29 after it. 14-day refund.

Questions people ask

What is keeping my Mac awake?

Run pmset -g assertions in Terminal. Each line under “Listed by owning process” names an app, how long it has held sleep off and why. In Activity Monitor, the Energy tab’s Preventing Sleep column shows Yes for the same apps.

Why won’t my Mac go to sleep when I close the lid?

On battery, a closed lid puts a MacBook to sleep whatever apps ask. With the lid closed on power and an external display connected, the Mac keeps running by design; Apple calls this closed-display mode. If it stays awake without those, check pmset -g assertions for PreventSystemSleep.

Why does my Mac wake up by itself at night?

Usually for maintenance, network activity or a connected device. Run pmset -g log | grep -E "Wake from|DarkWake from" | tail -20 and read the text after “due to”. Set Wake for network access to Only on Power Adapter if the network is the cause.

How do I stop an app from keeping my Mac awake?

Close what it is doing, such as the video, the call or the download, or quit the app. For caffeinate, press Control-C in its Terminal window or quit the app that started it.

Is it bad if my Mac never sleeps?

It costs power, and on a MacBook in a bag it builds heat and empties the battery. It does no harm on a desktop Mac you use as a server, as long as that is what you want.

Is there an app that shows what is keeping my Mac awake?

On a MacBook, Vitals lists the apps keeping it awake on its Battery tab and in the menu bar dropdown, with the reason each gives, how long it has held sleep off, and whether it keeps the screen on.

In the glossary

More guides