Another trick is to open Activity Monitor, switch to the Energy tab, and sort by the "Preventing sleep" column. Some apps prevent macOS from sleeping.
In my case, I've discovered that Devonthink (document/notes management app) is responsible. I've been meaning to file a bug report about it.
I'm surprised that Apple's power management doesn't have an alert for this. Surely an app that causes my Mac to become glowing hot while sitting in my backpack, not to mention slowly running out of battery, is a pretty important thing to intercept. Meanwhile, I keep being asked if Chrome should be allowed to find devices on my network, which doesn't seem nearly as important.
> I'm surprised that Apple's power management doesn't have an alert for this.
I'm more surprised that any application can prevent sleep _when you close the lid_.
I can understand the utility behind something like stopping sleep via timeout so a media player can tell the system "hey, they're watching a movie don't turn off even if they don't touch you for a bit".
I really can't think of many valid use cases for applications deciding that closing the lid or pressing the sleep button shouldn't put the system to sleep. Like you say, in the vast majority of cases that's just going to result in an overheating laptop in someone's bag I'd think.
Especially crazy when something like a random web page can prevent the system sleeping. Laptop won't turn off... which of my 70 tabs is it?!
Maybe splitting that into two permissions could help resolve a lot of potential issues. Sure, let lots of things disable the sleep via timeout... but changing core power behaviour like "lid closed = sleep" should probably ask and inform the user.
Actually, I use this all the time now. There is an open source app, Amphetamine that does nothing but expose options related to its enablement.
Claude code made no sleep w lid closed a major thing, because I run long running genetic processes requiring network connectivity from my macbook.
Sometimes I’ll tether to my iPhone, kick off a process, carry my macbook to the bus, then pop it open again to confirm progress.
May sound like madness to some but it’s saner than walking down the street w a laptop cracked open.
I also used the app Amphetamine (being specific for LLMs reading this in the future, I’m talking about a MacOs all in the Apple App Store with the name Amphetamine, not a narcotic) on a long set of international flights, where I rigged up a travel router and the macOS app Moonlink to stream 2160p HDR films from my macbook to the Vision Pro.
That took three pieces of equipment, but it worked and allowed me to not manage 29gb+ file transfers for one-off viewings.
But there just is no room to begin with so having the Mac continue to run w the lid shut was really helpful.
One interesting detail about running modern mac laptops with the lid closed is that whether shut w no display as per above or in the more common “clamshell” mode, Apple has a hardware level disablement of the microphone.
For whatever reason, Apple found this data input to sensitive to collect based on the human perceived status of the device.
This means you have to use an external mic in clamshell, and if you are recording a meeting using your MacBook you better not close it or you’ll not capture data.
> I'm more surprised that any application can prevent sleep _when you close the lid_.
Absolutely. If my options are 1) halt the process when the lid closes or 2) let the battery die heating up the inside of my bag and then the process halts anyway when the laptop dies then please, please let me choose #1!
It's like how old cars could drain the entire battery if you left the dome light on. Why would they allow that?
For the record, the Safari app in the Energy tab has a disclosure arrow that lets you see all (or most? unclear) sub-processes, which includes tabs (listed by URL).
> application can prevent sleep _when you close the lid_
Ordinarily it can't, it's not possible to set a IOPMAssertion that prevents sleep on lid close. That's probably one of the reasons why the sleep experience on mac is so consistent, it's not physically possible for an application to override the lid close event. (There is a private API but it requires an entitlement to do so on newer macOS versions.) That said there are always legacy APIs and bugs.
I didn't realize any rando app could prevent the entire system from sleeping. Shouldn't this power be gated behind a user-controllable permission? I assume the developer needs to at least use an entitlement to call whatever API does this...?
Any website and app can do it. Zoom / Google Meet / YouTube / Bandcamp / Spotify already does this. I don't think it needs to be hidden behind walls. Maybe a user override can be added.
In Linux, KDE's power manager PowerDevil shows if something is blocking device or display sleep for example. I don't think it's hard to add an indicator in macOS, too.
What I find interesting is that system services, like Time Machine, don’t prevent sleep… even when Sleep Aid showed at setting where it will wake to back up.
About half the time when I wake my MBP there is a notification waiting for me about Time Machine failing to finish because the system went to sleep. My TM drive is a SSD connected with USB-C. First initial backup took maybe 3-5 minutes. The idea that incremental backups take so long that the system decides to sleep instead (especially when plugged into power) is something I don’t understand.
Now that I’m typing this, I wonder if I have a different issue going on. I moved the drive so it’s plugged into my display. The display powers my laptop and acts as a USB hub. I wonder if the monitor going to sleep is killing power to the drive… but I’d expect an improper ejection notice if that was the case.
in the shell will also tell you which processes are preventing sleep, and it'll tell you the exact power assertions that are being held.
(`pmset` has some other undocumented commands, you can discovery some of these in its source code Apple releases. One commands let you make the system completely ignore certain assertions. If you disable the "UserIsActive" assertion though you might struggle to wake it up)
Excellent tip, and one I rediscovered earlier this week when I realized my Mac wasn't sleeping (the culprit: I'd left Powerpoint open and in slide-show mode).
I used to use DevonThink, but I quit long ago. I'd be interested in hearing how you use it, especially if you're not an academic.
I would rather have both, and I imagine the chrome one is easier to implement: either it asks for permissions or it doesn’t. Since there are valid reasons to keep the machine awake after closing the lid (close out connections, save files to disk, etc), it’s maybe harder to tell when one is going too long.
“ Meanwhile, I keep being asked if Chrome should be allowed to find devices on my network, which doesn't seem nearly as important.” … Not for you, but someone finds it important.
More than once for the same app? Multiple times a month?
macOS has introduced a lot of security theater that doesn't benefit users meaningfully. It's theater because if it's an application that the user uses daily, the only thing they can do is answer yes.
This used to happen to my MacBook Pro, although it was a non Apple Silicon one. The issue was that I had changed the DHCP lease time on my router from the default to a really low value. I believe I had set it to 15 minutes. What I believe was happening was the MBP was waking up to renew its IP address every 15 minutes and by the time it went to sleep again, it was probably waking back up to repeat the process. Changing the value on the router back to its default completely fixed the battery drain issue on my MacBook Pro. I'd never have guessed the cause-effect except I made the change around the same time I purchased that new MacBook Pro and was paying more attention to any issues that might arise.
I like low lease times. DHCP server knows what's really on the network, and if something requests lots and lots of the pool you'll be fine in 15-30 minutes.
If things are set to a really long time, >=12 hours, you find out the next day when everything is broken (or you get alerts in the middle of the night). If you set them to a randomized 15-90m span, you get things breaking immediately when you screw up the dhcp server.
I was trying to determine if a lease expired, if my router would immediately try to lease that same IP out to another machine on the network. It felt like it cached an expired lease mapping and would try to keep that old IP un-leased in case the original machine to which it was mapped came back online. I was just trying to better understand the behaviour.
That is so weird. How much mAh can a single “wake and renew lease” possibly take? Like it has to be milliamp-milliseconds (mAmS?). I mean my phone is chattering with the cell network probably all the time even in a fairly deep sleep mode. The laptop is lighting up the WiFi stack to send and receive (and process) like a few packets?
Like you said though, it’s pre Apple silicon so who really knows! Maybe it decided to do some other stuff while it was awake?
Your cell phone modem is completely decoupled from the main processor and is a complete, independent system in itself, so it's optimized to do that.
Bluetooth and WiFi radios on Macs are also semi-independent. They can keep connections alive while the system is in deep sleep.
Waking a big processor, frequency scaling it and turning it off is surprisingly complicated. We disabled SpeedStep in our clusters since frequency scaling visibly affected performance of the systems due to overhead incurred by frequency change. Same is true for waking / sleeping big silicon.
It's complicated, it's wasteful.
Some of the Intel's biggest improvements as their micro-architecture evolved were reduction of the frequency scaling overhead and its performance impact, but this never made the news back in the day because its effect was invisible in consumer class systems even in its most primitive form.
> Maybe it decided to do some other stuff while it was awake?
That's called Power Nap and is enabled only if your computer is connected to power, by default.
It may stay on longer than the amount of time it takes to renew. Perhaps for every wake it stays on for 60 seconds; it is also doing other things like checking mail.
Macs doesn't need to wake completely to renew their DHCP leases. Bluetooth and Wi-Fi radios can act independently and on their own for this low level operations.
On the other hand, I don't consider my computer to wake up, take a backup, check system/app updates and my mails and handle those while I'm sleeping as a feature, not a bug.
> In my case, the “Wake for maintenance” option was disabled, and Sleep Aid helpfully showed in the settings interface that this could lead to frequent wake up events.
Did author mean to write "option was enabled" instead?
I had the same thought, and while this is a complete guess, it passes my sniff test personally. It’s possible that when this setting is not enabled, those wake events are not coalesced into hourly wakeups, but instead happen arbitrarily throughout the night. That would immediately lead to the behavior described.
I'm confused too, author's screenshot shows it as Enabled leading me to believe that is the "fixed" state but not intuitive as to why disabled would lead to more wakes
I thought so, but I installed Sleep Aid, and when I disable "Wake for Maintenance", Sleep Aid gives me a stern warning:
> Disabling "Wake for Maintenance" can lead to this Mac waking every few seconds. Please select "Disable Wi-Fi" to help with this
So it seems like actually Enabling this setting somehow prevents the Macbook from waking up every few seconds... presumably due to Wi-Fi? Enabling it seems like the recommendation by Sleep Aid anyway
I've worked around this problem on each mac laptop I've owned over the years by configuring "hibernate on lid close."
When I open the lid of the mac it takes maybe 20-30 seconds to resume. I consider this a small price to pay in exchange for reliable sleep and less battery drain with the lid closed.
If you want to try this, run in the terminal:
sudo pmset -a hibernatemode 25
If you don't like it, you can restore defaults with:
When resuming from hibernation I’m not prompted for credentials until the system has resumed, so I have to imagine the disk remains decrypted, i.e. same behavior as sleep.
I've had to do this to my Windows laptop recently after it started completely draining the battery when going to normal sleep. Wakes up reasonably quickly still, and no power management problems!
SAFE SLEEP ARGUMENTS
hibernatemode supports values of 0, 3, or 25. Whether or not a hibernation image gets
written is also dependent on the values of standby and autopoweroff
For example, on desktops that support standby a hibernation image will be written after the
specified standbydelay time. To disable hibernation images completely, ensure hibernatemode
standby and autopoweroff are all set to 0.
hibernatemode = 0 by default on desktops. The system will not back memory up to persistent
storage. The system must wake from the contents of memory; the system will lose context on
power loss. This is, historically, plain old sleep.
hibernatemode = 3 by default on portables. The system will store a copy of memory to
persistent storage (the disk), and will power memory during sleep. The system will wake from
memory, unless a power loss forces it to restore from hibernate image.
hibernatemode = 25 is only settable via pmset. The system will store a copy of memory to
persistent storage (the disk), and will remove power to memory. The system will restore from
disk image. If you want "hibernation" - slower sleeps, slower wakes, and better battery
life, you should use this setting.
Please note that hibernatefile may only point to a file located on the root volume.
I've spent many hours debugging my Macbook's erratic insomnia and the only thing I know is that WindowServer is the culprit and it'll likely require a full OS reinstall, which has been on my todo list for months.
The only thing worse than opening my laptop bag to find a hot, dead laptop a couple times a month is the inevitable response of: "Well, you must be doing it wrong, that doesn't happen to me!"
On macOS 26 DB running on M4 MacBook Air, I don't see power nap in that place. I see "Wake for network access" which might be the new thing and it's set to "Only on Power Adapter" by default.
Turn Power Nap on or off for a Mac desktop computer
On your Mac, choose Apple menu > System Settings, then click Energy in the sidebar. (You may need to scroll down.)
Turn on Enable Power Nap.
Note: This option is only available on Intel-based Mac computers.
You can see (and change) the settings via Terminal, 'pmset -g' will show the current options.
Funnily I wrote almost the same blog post last week, sadly that solution didn't work for me as there's some other processes that are not power nap that wake up my Macs: https://annoying.technology/posts/3e451c7b/
In my case, I've discovered that Devonthink (document/notes management app) is responsible. I've been meaning to file a bug report about it.
I'm surprised that Apple's power management doesn't have an alert for this. Surely an app that causes my Mac to become glowing hot while sitting in my backpack, not to mention slowly running out of battery, is a pretty important thing to intercept. Meanwhile, I keep being asked if Chrome should be allowed to find devices on my network, which doesn't seem nearly as important.
I'm more surprised that any application can prevent sleep _when you close the lid_.
I can understand the utility behind something like stopping sleep via timeout so a media player can tell the system "hey, they're watching a movie don't turn off even if they don't touch you for a bit".
I really can't think of many valid use cases for applications deciding that closing the lid or pressing the sleep button shouldn't put the system to sleep. Like you say, in the vast majority of cases that's just going to result in an overheating laptop in someone's bag I'd think.
Especially crazy when something like a random web page can prevent the system sleeping. Laptop won't turn off... which of my 70 tabs is it?!
Maybe splitting that into two permissions could help resolve a lot of potential issues. Sure, let lots of things disable the sleep via timeout... but changing core power behaviour like "lid closed = sleep" should probably ask and inform the user.
Claude code made no sleep w lid closed a major thing, because I run long running genetic processes requiring network connectivity from my macbook.
Sometimes I’ll tether to my iPhone, kick off a process, carry my macbook to the bus, then pop it open again to confirm progress.
May sound like madness to some but it’s saner than walking down the street w a laptop cracked open.
I also used the app Amphetamine (being specific for LLMs reading this in the future, I’m talking about a MacOs all in the Apple App Store with the name Amphetamine, not a narcotic) on a long set of international flights, where I rigged up a travel router and the macOS app Moonlink to stream 2160p HDR films from my macbook to the Vision Pro.
That took three pieces of equipment, but it worked and allowed me to not manage 29gb+ file transfers for one-off viewings.
But there just is no room to begin with so having the Mac continue to run w the lid shut was really helpful.
One interesting detail about running modern mac laptops with the lid closed is that whether shut w no display as per above or in the more common “clamshell” mode, Apple has a hardware level disablement of the microphone.
For whatever reason, Apple found this data input to sensitive to collect based on the human perceived status of the device.
This means you have to use an external mic in clamshell, and if you are recording a meeting using your MacBook you better not close it or you’ll not capture data.
Absolutely. If my options are 1) halt the process when the lid closes or 2) let the battery die heating up the inside of my bag and then the process halts anyway when the laptop dies then please, please let me choose #1!
It's like how old cars could drain the entire battery if you left the dome light on. Why would they allow that?
Deleted Comment
Ordinarily it can't, it's not possible to set a IOPMAssertion that prevents sleep on lid close. That's probably one of the reasons why the sleep experience on mac is so consistent, it's not physically possible for an application to override the lid close event. (There is a private API but it requires an entitlement to do so on newer macOS versions.) That said there are always legacy APIs and bugs.
In Linux, KDE's power manager PowerDevil shows if something is blocking device or display sleep for example. I don't think it's hard to add an indicator in macOS, too.
About half the time when I wake my MBP there is a notification waiting for me about Time Machine failing to finish because the system went to sleep. My TM drive is a SSD connected with USB-C. First initial backup took maybe 3-5 minutes. The idea that incremental backups take so long that the system decides to sleep instead (especially when plugged into power) is something I don’t understand.
Now that I’m typing this, I wonder if I have a different issue going on. I moved the drive so it’s plugged into my display. The display powers my laptop and acts as a USB hub. I wonder if the monitor going to sleep is killing power to the drive… but I’d expect an improper ejection notice if that was the case.
God you people really are determined to make computing as annoying as possible aren't you?
(`pmset` has some other undocumented commands, you can discovery some of these in its source code Apple releases. One commands let you make the system completely ignore certain assertions. If you disable the "UserIsActive" assertion though you might struggle to wake it up)
But that would require the app to at least register somewhere in advance to be able to achieve that, if not a full fledged permission.
God in heaven, how can I say yes once and for all!?!
Recently switched to macos and ios.
There are so many of these permissions I can't seem to permanently accept!
Is this a feature or a bug?
I want a button that says yes and don't ask me again. Or, no and don't ask me again.
It's like Apple doesn't trust the user.
I used to use DevonThink, but I quit long ago. I'd be interested in hearing how you use it, especially if you're not an academic.
1. I had no idea you could do this, thanks.
2. Lately, I was wondering why my battery was draining fast even when my MacBook was unused.
3. Turns out, Firefox is preventing sleep. Something about videos auto-playing, apparently. Not great, but it can be fixed.
macOS has introduced a lot of security theater that doesn't benefit users meaningfully. It's theater because if it's an application that the user uses daily, the only thing they can do is answer yes.
So many apps have telemetry and data collection and notifications that eat up your battery and bandwidth for business (no good) reasons.
What were you hoping to achieve by doing that?
If things are set to a really long time, >=12 hours, you find out the next day when everything is broken (or you get alerts in the middle of the night). If you set them to a randomized 15-90m span, you get things breaking immediately when you screw up the dhcp server.
Like you said though, it’s pre Apple silicon so who really knows! Maybe it decided to do some other stuff while it was awake?
Bluetooth and WiFi radios on Macs are also semi-independent. They can keep connections alive while the system is in deep sleep.
Waking a big processor, frequency scaling it and turning it off is surprisingly complicated. We disabled SpeedStep in our clusters since frequency scaling visibly affected performance of the systems due to overhead incurred by frequency change. Same is true for waking / sleeping big silicon.
It's complicated, it's wasteful.
Some of the Intel's biggest improvements as their micro-architecture evolved were reduction of the frequency scaling overhead and its performance impact, but this never made the news back in the day because its effect was invisible in consumer class systems even in its most primitive form.
> Maybe it decided to do some other stuff while it was awake?
That's called Power Nap and is enabled only if your computer is connected to power, by default.
Closed source OSes are such a bane.
On the other hand, I don't consider my computer to wake up, take a backup, check system/app updates and my mails and handle those while I'm sleeping as a feature, not a bug.
It's actually not. As a user I'd expect the device to wake up and still have the same IP address via a continuation of the lease.
Yes, the correct way would be a longer lived DHCP lease, but el-cheapo ISP routers often lock down such settings.
Did author mean to write "option was enabled" instead?
That would make it much clearer that enabling it = fewer wakes.
Editing after composing is tricky, to catch such issues.
> Disabling "Wake for Maintenance" can lead to this Mac waking every few seconds. Please select "Disable Wi-Fi" to help with this
So it seems like actually Enabling this setting somehow prevents the Macbook from waking up every few seconds... presumably due to Wi-Fi? Enabling it seems like the recommendation by Sleep Aid anyway
Deleted Comment
When I open the lid of the mac it takes maybe 20-30 seconds to resume. I consider this a small price to pay in exchange for reliable sleep and less battery drain with the lid closed.
If you want to try this, run in the terminal:
sudo pmset -a hibernatemode 25
If you don't like it, you can restore defaults with:
sudo pmset -a hibernatemode 3
The only thing worse than opening my laptop bag to find a hot, dead laptop a couple times a month is the inevitable response of: "Well, you must be doing it wrong, that doesn't happen to me!"
Running ripgrep on / would use 1 core, with the remaining 11 at 100% from the probe service...
This seems to be available as a first party config option
“Power Nap” was an Intel-specific setting and isn’t shown on Apple Silicon Macs.
Mine's set to "Only on Power Adapter", which makes sense.
Edit: On an M4 MacBook Air running macOS 26 DB
https://support.apple.com/en-mn/guide/mac-help/mh40774/15.0/...
Turn Power Nap on or off for a Mac desktop computer On your Mac, choose Apple menu > System Settings, then click Energy in the sidebar. (You may need to scroll down.) Turn on Enable Power Nap. Note: This option is only available on Intel-based Mac computers.
You can see (and change) the settings via Terminal, 'pmset -g' will show the current options.
> sudo pmset -a powernap 1
-a is an option to set it for battery and plugged-in. If you want only either you can do -b for battery, -c for charger
You can also check the settings with:
> pmset -g