How to get Intel iMac (or Mini) to remain in "deep" sleep (hibernatemode 25)?

I've been trying to get my Intel iMac to go into deep sleep (hibernatemode 25) and stay there without interuptions; does anyone know of a guide as to how to achieve this; or whether it's possible without third party apps? On a MacBook Air it took about three minutes to set up and the logs showed it as remaining asleep for 9 hours with almost no battery energy loss.

iMac 21.5″, macOS 15.7

Posted on Sep 1, 2026 6:27 AM

Reply
Question marked as Top-ranking reply

Posted on Sep 2, 2026 11:34 PM

The lost post is redundant; uninterupted sleep has worked; here is the guide:

iMac & Mac Mini Deep Sleep Setup Guide

(Explanatory notes for each numbered step are located at the bottom of this guide. Code blocks for steps 4 and 6 are located in the Additional Text box.)

Quick Setup Steps

  1. Download and install Hammerspoon from hammerspoon.org, then enable permissions under System Settings > General > Login Items (Open at Login) and Privacy & Security (Accessibility and Input Monitoring).
  2. Open the Calendar app, go to Settings > Alerts, uncheck "Time to Leave", and set "Events" and "All Day Events" to None.
  3. Open Terminal and run:
sudo pmset -a tcpkeepalive 0 powernap 0 womp 0
sudo launchctl bootout system/com.apple.osanalyticsdIn Terminal, run sudo nano /Library/Preferences/FeatureFlags/Domain/powerd.plist, paste Script 1 (from the Additional Text box), press Ctrl + O (then Enter) to save, and Ctrl + X to exit.
  1. In Terminal, run sudo nano /etc/sudoers.d/btt_bluetooth, paste z ALL=(ALL) NOPASSWD: /usr/bin/pmset, /bin/launchctl, press Ctrl + O (then Enter) to save, and Ctrl + X to exit.
  2. Click the Hammerspoon menu bar icon and select Open Config. Delete any existing text in the document, paste Script 2 (from the Additional Text box), save the file (Cmd + S), and click Reload Config in the Hammerspoon menu bar.
  3. To put your Mac to sleep, press Option + /.
  4. To wake your Mac, press the physical Power Button, then wait 15 seconds before interacting.

Explanatory Notes

  • 1: Hammerspoon requires accessibility and input permissions to detect global keyboard shortcuts and trigger actions without security prompts.
  • 2: Calendar "Time to Leave" and event alerts schedule hardware real-time clock (RTC) alarms that bypass system sleep settings.
  • 3: Stops background network polling and unloads the telemetry engine (osanalyticsd) to prevent automated background wake events.
  • 1 : The powerd.plist file overrides system feature flags to permanently stop hardcoded 2-hour maintenance evaluation dark wakes (CSPNEvaluation).
  • 2: Grants Hammerspoon passwordless execution rights for system power and launch control commands.
  • 3a: Clearing default text in Hammerspoon prevents Lua syntax errors.
  • 3b: The script unloads Bluetooth before sleeping to prevent peripheral wake-loops in deep hibernation (hibernatemode 25). Upon power-button wake, it restores Bluetooth and resets the system to light RAM sleep (hibernatemode 0) so short daytime idle breaks do not cause excessive write wear on your SSD.
  • 3c: A 2-second buffer prevents physical key-up actions from canceling the sleep command.
  • 4: Gives macOS 15 seconds to re-establish Bluetooth, Wi-Fi, and background services, preventing UI lockups when clicking complex elements.

Verification

To check that deep sleep has fully worked, run this command in Terminal:

Bash


pmset -g log | grep -E "Sleep|Wake|DarkWake" | tail -n 250 > ~/Desktop/pmset_sleep_log.txt

This will generate a text file named pmset_sleep_log.txt on your Desktop. Inspecting the log should show no entries between the moment sleep was initiated and the moment the machine was woken by the power button.

16 replies
Question marked as Top-ranking reply

Sep 2, 2026 11:34 PM in response to John Galt

The lost post is redundant; uninterupted sleep has worked; here is the guide:

iMac & Mac Mini Deep Sleep Setup Guide

(Explanatory notes for each numbered step are located at the bottom of this guide. Code blocks for steps 4 and 6 are located in the Additional Text box.)

Quick Setup Steps

  1. Download and install Hammerspoon from hammerspoon.org, then enable permissions under System Settings > General > Login Items (Open at Login) and Privacy & Security (Accessibility and Input Monitoring).
  2. Open the Calendar app, go to Settings > Alerts, uncheck "Time to Leave", and set "Events" and "All Day Events" to None.
  3. Open Terminal and run:
sudo pmset -a tcpkeepalive 0 powernap 0 womp 0
sudo launchctl bootout system/com.apple.osanalyticsdIn Terminal, run sudo nano /Library/Preferences/FeatureFlags/Domain/powerd.plist, paste Script 1 (from the Additional Text box), press Ctrl + O (then Enter) to save, and Ctrl + X to exit.
  1. In Terminal, run sudo nano /etc/sudoers.d/btt_bluetooth, paste z ALL=(ALL) NOPASSWD: /usr/bin/pmset, /bin/launchctl, press Ctrl + O (then Enter) to save, and Ctrl + X to exit.
  2. Click the Hammerspoon menu bar icon and select Open Config. Delete any existing text in the document, paste Script 2 (from the Additional Text box), save the file (Cmd + S), and click Reload Config in the Hammerspoon menu bar.
  3. To put your Mac to sleep, press Option + /.
  4. To wake your Mac, press the physical Power Button, then wait 15 seconds before interacting.

Explanatory Notes

  • 1: Hammerspoon requires accessibility and input permissions to detect global keyboard shortcuts and trigger actions without security prompts.
  • 2: Calendar "Time to Leave" and event alerts schedule hardware real-time clock (RTC) alarms that bypass system sleep settings.
  • 3: Stops background network polling and unloads the telemetry engine (osanalyticsd) to prevent automated background wake events.
  • 1 : The powerd.plist file overrides system feature flags to permanently stop hardcoded 2-hour maintenance evaluation dark wakes (CSPNEvaluation).
  • 2: Grants Hammerspoon passwordless execution rights for system power and launch control commands.
  • 3a: Clearing default text in Hammerspoon prevents Lua syntax errors.
  • 3b: The script unloads Bluetooth before sleeping to prevent peripheral wake-loops in deep hibernation (hibernatemode 25). Upon power-button wake, it restores Bluetooth and resets the system to light RAM sleep (hibernatemode 0) so short daytime idle breaks do not cause excessive write wear on your SSD.
  • 3c: A 2-second buffer prevents physical key-up actions from canceling the sleep command.
  • 4: Gives macOS 15 seconds to re-establish Bluetooth, Wi-Fi, and background services, preventing UI lockups when clicking complex elements.

Verification

To check that deep sleep has fully worked, run this command in Terminal:

Bash


pmset -g log | grep -E "Sleep|Wake|DarkWake" | tail -n 250 > ~/Desktop/pmset_sleep_log.txt

This will generate a text file named pmset_sleep_log.txt on your Desktop. Inspecting the log should show no entries between the moment sleep was initiated and the moment the machine was woken by the power button.

Sep 1, 2026 7:34 AM in response to desm1

What version of 15.7 are the Mac's running..?

What mouse is connected to the Mac's...?

What App's are open on these Mac's..?


-----------

Test the following "Energy" settings.



Then select "Sleep" from the drop down menu.



If it does not sleep, check the Activity Monitor for a process that is Preventing sleep.

If it tries to sleep but then re-wakes, start disconnecting USB devices and re-test.


-----------

If you have changed the pmset via terminal using AI's advise...?

Return the pmset to default and stop following that advise.


-----------

FWIW the above settings work on our 2018 Intel and 2020 M1 Mac mini's running Sequoia 15.7.9 using USB mice.

The trick is to not move the mouse after selecting Sleep from the drop down menu.

Sep 10, 2026 4:18 PM in response to desm1

The numbering system went awry when pasting so the revised (2nd step 1.) explanatory note for the second "1."should have "global" replaced with "relevant" and any content in the Nano file replaced with the following BUT with your username at the commencement of each line (type: "whoami" in Terminal, if unsure of name) or use %admin as below:

%admin ALL=(ALL) NOPASSWD: /usr/bin/pmset -a hibernatemode 25

%admin ALL=(ALL) NOPASSWD: /usr/bin/pmset -a hibernatemode 0

%admin ALL=(ALL) NOPASSWD: /usr/bin/pmset schedule cancelall

%admin =(ALL) NOPASSWD: /usr/bin/pmset sleepnow

%admin ALL=(ALL) NOPASSWD: /bin/launchctl bootout gui/* /System/Library/LaunchAgents/com.apple.bluetoothuseragent.plist

%admin ALL=(ALL) NOPASSWD: /bin/launchctl bootstrap gui/* /System/Library/LaunchAgents/com.apple.bluetoothuseragent.plist




Sep 1, 2026 10:49 PM in response to tbirdvet

According to the numbers I've seen; with just the Display off an Intel iMac will be using about 47 times more power than if in deep (hibernatemode 25) sleep - so for those who leave the device on most of the time, that is the equivalent of leaving a couple of LED lights on all day and night to save having to flick the switch (and wait a few seconds). Have you advised/explained to Apple Inc. that for general users "do not use sleep (which can cause other issues)"; they would have to be considerable to burn 70 or so kWh per annum?

Sep 2, 2026 7:28 AM in response to desm1

All you had to do was answer the three questions.

What version of 15.7 are the Mac's running..?

What mouse is connected to the Mac's...?

What App's are open on these Mac's..?


Then tell us what happened when you tested the Energy settings that I suggested.


If those settings did not work and you are concerned about power consumption using Display off, then Shut Down... the Mac when it is not in use.

Sep 2, 2026 8:23 AM in response to den.thed

What was in my lengthy response/answer that you didn't receive? It seems that I needed to hit the Post button and probably failed to do so as I was constantly going back and forth checking facts. I didn't ask for questions but for one answer and so far no meaningful response; it looks like there is nothing in this community on the topic; maybe owing to a lack of interest or to the complexity.


Subject to further testing over some time it looks like I've managed to get total uninterupted sleep working for 3 hours so it should be permanent. It can't be achieved via GUI or pmset so it looks like it's up to me to write the guidance; I had thought/suspected that this must have been done and published and that I was just "reinventing the wheel"; do you want a copy; there doesn't seem to be any suitable section here for tutorials etc. so it may need to go onto Github or similar.


It's a moot point now, but the suggestion to try: Prevent automatic sleeping....display is off - seems odd as that is the only setting I'm aware of which is intended to stop any sleep and override any settings other than so called "Display sleep."

Sep 3, 2026 2:32 AM in response to tbirdvet

I've generally understood that for any phone/computer that the consumer of the most energy is the screen; what was somewhat revelatory in this project was to discover that the main reason to use a Sleep setting rather than just "Display off" is that the "screen" remains using much of the power even with the display off. This is less so with a Mini but it will still be using about 1000% more compared to hibernatemode25 (deep) sleep; that's about 20 kg of CO2 annually; if 40 million users don't bother going beyond Display sleep.... I'll let you do the math.


I've just changed my settings on the iMac to set it for Display off only - for when I've gone on short breaks - often longer than planned, but that's owing to complexities in my setup such that it's that or manually forced Deep sleep; which has worked and with no instability issues, and is used daily.

Sep 8, 2026 8:35 PM in response to desm1

desm1 wrote:
<plist and script.log>
sudo launchctl bootout system/com.apple.osanalyticsdIn Terminal, run sudo nano /Library/Preferences/FeatureFlags/Domain/powerd.plist, paste Script 1 (from the Additional Text box), press Ctrl + O (then Enter) to save, and Ctrl + X to exit.
1. In Terminal, run sudo nano /etc/sudoers.d/btt_bluetooth, paste z ALL=(ALL) NOPASSWD: /usr/bin/pmset, /bin/launchctl, press Ctrl + O (then Enter) to save, and Ctrl + X to exit.

Oh, this is so dangerous and even partially incorrect!!


First, you should never, ever edit the "sudoers" file directly. In fact that file has a very clear & explicit warning at the beginning of that file.


Second, it is much better to put any such customizations into their own configuration file in the "/etc/sudoers.d" folder. Using the "visudo" command (you can configure it to use "nano" as the editor by prepending "EDITOR=nano") will ensure the correct permissions exist on any file edited & created for use by "sudoers" and it will ensure that the correct syntax is followed within that file before allowing the editor to close. This is critical because if the syntax is broken, then things will likely break because even the default configuration options in this file may not be read from a broken "sudoers" file.


Third, if you insert custom permissions/options at the wrong location in the "sudoers" file, then it can have even worse consequences than when they may be placed in the correct location.


If people make a mistake in editing "sudoers", then it will break macOS and may lead to a very difficult recovery. At least if a mistake is made in a separate configuration file it will help minimize some of the risk as the Finder can likely be used to rename/move the problem file which is much easier than trying to figure out how to fix that file...plus it is much easier to do this if the system must be booted into Recovery Mode to fix the problem with "sudoers".


Fourth, you should make sure to minimize any permissions given here by restricting the looser permissions only to very specific command options. For example, instead of allowing no password for all "pmset" options as you have done.....you should only include the very specific options required like: "/usr/bin/pmset -a hibernatemode 25", "/usr/bin/pmset schedule cancelall", and "/usr/bin/pmset sleepnow". This way if you were to use a different option, it would prompt you for a password.


Consider that you are allowing all "launchctl" options to be used for anything. This is extremely dangerous as anything could take advantage of your loose configuration to do more damage (intentionally or accidentally through a mistake or a bug). There can also be other unintended & unexpected side effects from other installed apps/utilities which may utilize these commands.


I may even be missing some things here.


People really need to think very carefully about making any modifications to "sudoers". In fact it is best to ask yourself if there is a better & safer way to achieve my goals so that "sudoers" does not need to be modified. If modifying "sudoers" is the only option, then make sure to limit those changes to very specific cases to minimize any unrealized consequences. Modifying "sudoers" should never be taken lightly.


Sep 10, 2026 12:09 AM in response to desm1

The numbering system went awry when pasting so the revised (2nd step 1.) explanatory note for the second "1."should have "global" replaced with "relevant" and any content in the Nano file replaced with:

z ALL=(ALL) NOPASSWD: /usr/bin/pmset -a hibernatemode 25

z ALL=(ALL) NOPASSWD: /usr/bin/pmset -a hibernatemode 0

z ALL=(ALL) NOPASSWD: /usr/bin/pmset schedule cancelall

z ALL=(ALL) NOPASSWD: /usr/bin/pmset sleepnow

z ALL=(ALL) NOPASSWD: /bin/launchctl bootout gui/* /System/Library/LaunchAgents/com.apple.bluetoothuseragent.plist

z ALL=(ALL) NOPASSWD: /bin/launchctl bootstrap gui/* /System/Library/LaunchAgents/com.apple.bluetoothuseragent.plist




Sep 10, 2026 8:18 PM in response to Kurt Lang

This started as a "5 minute project" to save that 1 watt of wasted power usage and a key element was to not have to use the power button (based on probably exaggerated fear based on experiences where buttons have been first source of degradaion for a number of devices). Since it can't come out of hibernatemode 25 with other than the power button that has fallen by the wayside (actually it may be possible via a Bluetooth signal).


It is normally turned off overnight - so this 30+ hour investment is only used for abscences of around > 40mins; the total sleep is req'd to stop the repeated writes of RAM to Disk to RAM which occur with any brief maintainence wakes. This device has a non -Apple SSD installed which does apparently add considerably to the start time. Thanks for the question it's led me to commence checking out the Bluetooth start and TRIM starting delay.


While the effort to outcome ratio has been dubious it has led to a lot of insights into numerous elements of the Sleep setup; script functions and syntax, GUI vs Terminal, and customer friction minimization outcomes. At some point I started to set this up on a MacBook (where it's more useful) and it took about 2 mins with no apps/scripts or Terminal commands that I can recall so that was unexpected and pleasing.

How to get Intel iMac (or Mini) to remain in "deep" sleep (hibernatemode 25)?

Welcome to Apple Support Community
A forum where Apple customers help each other with their products. Get started with your Apple Account.