The Mystery of the Drained Battery
Every Mac administrator has encountered this specific user complaint: “I closed my MacBook lid on Friday with a 100% battery. When I opened it on Monday morning, the battery was completely dead.”
macOS is engineered to enter a deep sleep state (standby) when the lid is closed, sipping almost zero power. If a battery drains overnight, it means the Mac was not actually sleeping. A rogue application, a misconfigured network setting, or a faulty Bluetooth device was actively preventing the kernel from entering sleep mode, or repeatedly waking the Mac up in the middle of the night (a condition known as “Dark Wake”).
The graphical System Settings app provides virtually no troubleshooting information for power issues. To diagnose sleep failures and fundamentally rewrite how the Mac handles power, administrators must use the pmset (Power Management Settings) command in the terminal.
Step 1: Diagnosing Sleep Preventers (Assertions)
If a Mac refuses to go to sleep when the lid is open and inactive, you must figure out which application is actively holding the machine awake.
In macOS, an application can file an “Assertion” with the kernel. For example, if you are rendering a 4K video in Final Cut Pro, the application files an assertion stating: “Do not go to sleep, even if the user hasn’t touched the keyboard in 2 hours.”
To view a live, detailed list of every single active assertion currently blocking sleep, run:
pmset -g assertions
The output is heavily structured. Look specifically at the top summary block. If you see PreventUserIdleSystemSleep == 1, it means a process is blocking sleep.
Scroll down to the detailed list below the summary to find the culprit. You might see an entry like:
pid 451(Google Chrome): [0x00000050000182b2] 00:45:12 PreventUserIdleSystemSleep named: "WebRTC Audio/Video"
This definitively proves that a Google Chrome tab (likely a forgotten video call) is the exact process keeping the Mac awake.
Step 2: Analyzing the Historical Sleep Log
If the battery drained overnight, checking current assertions won’t help; you need to see what happened in the past.
The pmset command has a built-in logging engine that records every single time the Mac went to sleep, every time it woke up, and exactly why it woke up.
pmset -g log | grep -e "Wake " -e "DarkWake " -e "Sleep "
This command filters the massive log file. You are looking for the “Wake Reason.”
- If the wake reason is
LidOpen, a human opened the laptop. - If the wake reason is
RTC (Alarm), macOS intentionally woke itself up to perform background maintenance (like fetching emails in Power Nap mode). - If the wake reason is
GLANorEHC, a network packet (Wake-on-LAN) or a USB device (like a faulty mouse) fired a hardware interrupt, violently waking the machine up.
If you see a DarkWake event firing every 4 minutes throughout the entire night, you have found the cause of the dead battery.
Step 3: Viewing and Modifying Power Configurations
To view the current power management configuration, run:
pmset -g
This displays the settings for the currently active power source (Battery or AC Power). You will see variables like displaysleep, disksleep, and tcpkeepalive.
To modify these settings, you must run pmset as root (sudo) and specify which power source you are modifying: -b (Battery), -c (AC Charger), or -a (All).
For example, if you want to ensure the Mac never goes to sleep while plugged into the charger (vital for a machine acting as a build server), but sleeps normally on battery:
sudo pmset -c sleep 0
(Setting a value to 0 disables it).
Step 4: Disabling TCP Keep Alive (The Ultimate Battery Saver)
The most common cause of overnight battery drain on modern Apple Silicon Macs is the tcpkeepalive function. When the Mac is asleep, it periodically wakes up the Wi-Fi card (in a low-power state) to maintain active TCP connections to iCloud and iMessage, ensuring you receive notifications the exact second you open the lid.
In highly congested Wi-Fi environments (like an apartment building), this feature can glitch, causing the Mac to thrash and drain 20% of its battery overnight.
If absolute battery preservation is your goal, you can forcefully sever the Mac from the internet while it sleeps:
sudo pmset -a tcpkeepalive 0
Warning: macOS will display a severe warning that Find My Mac will cease to function while the laptop is asleep. If the laptop is stolen and closed, it cannot report its location until the thief opens the lid.
Step 5: Managing Hibernation Modes (Standby)
When a Mac sleeps, it keeps the RAM powered on so it can wake up instantly. If the battery drops critically low, it enters Hibernation (Standby), writing the contents of the RAM to the SSD and shutting off power entirely.
You can adjust how long the Mac waits in normal sleep before entering deep hibernation. By default, it might wait 24 hours.
To force the Mac to enter deep hibernation after only 2 hours (7200 seconds) of sleep, preserving massive amounts of battery over a weekend:
sudo pmset -a standbydelayhigh 7200
sudo pmset -a standbydelaylow 7200
Conclusion
Overnight battery drain is rarely a hardware defect; it is almost always a software configuration issue. By utilizing the pmset command to interrogate kernel assertions, analyze historical wake logs, and forcefully tune advanced hibernation and TCP keep-alive variables, Mac administrators can eliminate “Dark Wakes” and restore predictable, mathematically precise power management to the macOS fleet.