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

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.