Modern Mac hardware—specifically MacBook Pro and MacBook Air devices powered by Apple silicon (M1 through M4 chips)—boasts industry-leading battery efficiency and near-instantaneous sleep recovery. However, rogue background processes, persistent external peripherals, or misconfigured Power Nap settings can prevent a Mac from sleeping, leading to unexplained battery drain while enclosed in a laptop sleeve or unexpected disconnects across remote SSH sessions.
While the graphical macOS System Settings app offers basic battery management toggles, precise power governance requires the native terminal power management settings utility: pmset. Interfacing directly with the I/O Kit power management subsystem and the macOS kernel, pmset allows systems administrators and power users to audit active power assertions, configure distinct sleep profiles for battery versus AC power, disable network wake triggers, and schedule automated system restarts. This technical guide explores pmset settings, diagnostic logging queries, power assertion debugging, and automated power schedules.
Understanding macOS Power Management Scopes (-c, -b, -u, -a)
When applying power parameters using pmset, you must specify the power source scope flag:
| Scope Flag | Target Power Source | Application Context |
|---|---|---|
-c |
Charger / AC Power | Settings apply strictly when the Mac is plugged into mains power. |
-b |
Battery Power | Settings apply strictly when the laptop operates on internal battery reserves. |
-u |
UPS (Uninterruptible Power Supply) | Settings apply when connected to a USB/networked emergency battery backup. |
-a |
All Sources | Settings apply universally across battery, charger, and UPS contexts. |
Step 1: Reading Active Power Settings and Profiles
To inspect your Mac’s current power management configuration:
pmset -g
To view the distinct settings configured for each power source (AC vs. Battery):
pmset -g custom
Key Parameters Decoded
sleep— Idle timer (in minutes) before the system enters standby sleep (0 disables sleep).displaysleep— Idle timer (in minutes) before screens power off.disksleep— Hard disk spin-down timer (primarily relevant for external mechanical drives).womp— Wake on Magic Packet / Wake-on-LAN (1 = enabled, 0 = disabled).tcpkeepalive— Maintains active network connections during sleep for Find My and notifications.standby— Triggers deep standby sleep mode when idle.
Step 2: Diagnosing Battery Drain with Power Assertions (-g assertions)
When a Mac refuses to sleep after closing the lid or reaching its idle timeout, an application is holding an active power assertion:
pmset -g assertions
The console lists all active assertions. Look specifically for:
PreventUserIdleSystemSleep: A background process (such as a torrent client, video rendering queue, or backup script) is preventing sleep. The terminal output identifies the exact process name and PID.PreventUserIdleDisplaySleep: A media player or meeting app (like Google Meet or Zoom) is keeping the monitor illuminated.
Inspecting Sleep and Wake History Logs
To audit why your Mac woke up during the night:
pmset -g log | grep -e "Wake" -e "DarkWake" | tail -n 25
This surfaces whether wakes were initiated by lid opening (LidOpen), USB peripherals (EUSB), or background maintenance (MaintenanceWake).
Step 3: Configuring Custom Sleep and Energy Timers
All configuration changes require elevated root permissions (sudo):
Disabling Sleep While on Mains Power (Ideal for Build Servers)
# Prevent system sleep when connected to charger, but turn off displays after 15 mins
sudo pmset -c sleep 0 displaysleep 15
Enforcing Aggressive Battery Saving on Battery Power
# Put displays to sleep after 5 minutes and system to sleep after 10 minutes on battery
sudo pmset -b displaysleep 5 sleep 10
Disabling Wake on Network Access (Preventing Ghost Wakes)
# Disable Wake on LAN across all power sources
sudo pmset -a womp 0
Step 4: Scheduling Automated Wake, Sleep, and Restart Events
For office workstations or laboratory computers that need to turn on before business hours and shut down overnight:
Scheduling Daily Startup
To automatically wake or power on the Mac every Monday through Friday at 07:30 AM:
sudo pmset repeat wakeorpoweron MTWRF 07:30:00
Scheduling Nightly Shutdown
To automatically shut down the Mac every evening at 11:00 PM:
sudo pmset repeat shutdown MTWRFSU 23:00:00
Viewing or Cancelling Scheduled Power Events
# Check active scheduled power events
pmset -g sched
# Cancel all scheduled wake/sleep events
sudo pmset repeat cancel
Operational Best Practices for Apple Silicon
- Keep tcpkeepalive Enabled on Laptops: Setting
tcpkeepalive 0on a MacBook breaks Find My geolocation tracking while the lid is closed. Keep it set to1unless diagnosing extreme battery drainage. - Restoring Default Factory Profiles: If custom testing has left your sleep profiles unstable, restore macOS factory power defaults with:
sudo pmset -a restoredefaults