Guide · Updated 2026-10

Mac won't sleep? Here's how to find out why

Something is holding your Mac awake, and macOS will tell you what if you ask. One Terminal command names the app, then the fix is usually a click.

The short answer

Run pmset -g assertions in Terminal. Any line with PreventUserIdleSystemSleep or PreventSystemSleep names the process keeping the Mac up: quit that app. Nothing listed? Check pmset -g for SleepDisabled 1 (undo it with sudo pmset -a disablesleep 0) and for a sleep 0 value. If the Mac sleeps but wakes again, pmset -g log | grep "due to" shows why.

1. Ask macOS who's holding it awake

Apps keep a Mac awake by holding a power assertion. List them:

pmset -g assertions

The top half counts each type. Any non-zero PreventUserIdleSystemSleep or PreventSystemSleep means something is stopping sleep. The bottom half, under “Listed by owning process,” names who:

pid 63687(caffeinate): [0x...] 00:03:42 PreventUserIdleSystemSleep named: "caffeinate command-line tool"

A PreventUserIdleDisplaySleep line keeps only the screen on, which also stops idle sleep while it lasts. Quick version, just the names:

pmset -g | grep "prevented by"
 sleep        1 (sleep prevented by coreaudiod, caffeinate)

2. The usual suspects

You seeWhat it meansFix
coreaudiodSomething is playing sound, even silentlyClose the browser tab or app that played audio
A browserA video, a call, or a page that asked to stay awakeClose the tab
caffeinateA Terminal command or script is holding itkillall caffeinate
backupdTime Machine is backing upLet it finish
sharingd, screensharingdAirDrop, file sharing, or a screen shareEnd the share, or turn sharing off in General › Sharing
A keep-awake appAmphetamine, KeepingYouAwake, Midnight Oil, and so onEnd its session from the menu bar

With Midnight Oil, the flame in the menu bar shows when a session is running and what started it, and midnightoil status says the same in Terminal.

3. Nothing listed? Check the settings

pmset -g
  • SleepDisabled 1: someone ran sudo pmset -a disablesleep 1, and the Mac won't sleep at all, lid included. Undo it with sudo pmset -a disablesleep 0.
  • sleep 0: system sleep is set to never. Restore a value, for example sudo pmset -c sleep 10 on the charger.
  • On a MacBook, check System Settings › Battery › Options for Prevent automatic sleeping on power adapter when the display is off. On a desktop Mac it's in Energy.

Every setting is explained in Mac sleep settings.

4. It sleeps, then wakes right back up

That's a different problem. Ask the power log what woke it:

pmset -g log | grep "due to"

Common reasons and what to do:

  • Network or a sharing service: turn off Wake for network access in Battery › Options or Energy.
  • USB or Bluetooth: a mouse, keyboard, or dock nudged it. Unplug the device to confirm.
  • A scheduled wake: pmset -g sched lists them; sudo pmset repeat cancel removes a repeating one.
  • DarkWake lines are Power Nap and maintenance wakes. They're brief and normal.

The flip side: awake only when you mean it

A Mac that stays awake by accident drains the battery and runs warm. One that stays awake on purpose is how downloads, builds, and AI agents finish overnight. The difference is ending it: a session that stops by itself when the job is done, at a set time, or when the battery gets low. That's what Midnight Oil does, and when it ends, your Mac sleeps on its normal schedule again.

Questions

Why won't my Mac go to sleep?

Usually an app is holding a power assertion: music or video playing, a download, a backup, a screen share, or a keep-awake tool. Run pmset -g assertions in Terminal to see which, then quit it. If none is listed, check pmset -g for SleepDisabled 1 or sleep 0.

What is coreaudiod and why is it keeping my Mac awake?

coreaudiod is macOS's audio service. It holds the Mac awake while any app plays sound, including a muted browser tab or a paused stream that never released audio. Close the tab or quit the app that was playing.

How do I see what woke my Mac?

Run pmset -g log | grep "due to" in Terminal. Each wake lists a reason, such as the lid opening, a USB device, the network, or a scheduled wake.

Can a keep-awake app stop my Mac from sleeping after I quit it?

Not one that uses power assertions: macOS releases them when the app quits. The exception is anything that ran sudo pmset -a disablesleep 1, which stays on until it's turned off. Midnight Oil turns closed-lid mode off again when a session ends or the app quits.

My MacBook doesn't sleep when I close the lid. Why?

Either an external display, power, and keyboard are connected, which is Apple's clamshell mode, or sleep was disabled with pmset. Run pmset -g and look for SleepDisabled 1.

Stay awake on purpose, not by accident.

Free. No account, no subscription.

macOS 14 or later · Apple Silicon and Intel · brew install --cask coreyhaines31/tap/midnightoil