pmset

display and alter power management settings

caffeniate

pmset -g [option]
pmset [-a | -b | -c | -u] [value] [...]
pmset -u [haltlevel percent] [haltafter minutes] [haltremain minutes]
pmset schedule [cancel | cancelall] type date+time [owner]
pmset repeat cancel
pmset repeat type weekdays time
pmset relative [wake | poweron] seconds
pmset [touch | sleepnow | displaysleepnow | boot]

Manages power management settings such as idle sleep timing, wake on administrative access, automatic restart on power loss, etc

Processes may override power management settings by using I/O Kit power assertions,

Getting

-g settings currently in use.
 pmset -g         
System-wide power settings:
Currently in use:
 lidwake              1
 autopoweroff         1
 standbydelayhigh     86400
 autopoweroffdelay    28800
 standbydelaylow      10800
 standby              1
 proximitywake        0
 ttyskeepawake        1
 hibernatemode        3
 gpuswitch            2
 powernap             1
 hibernatefile        /var/vm/sleepimage 
                ls -l /var/vm/sleepimage
                    -rw------T  1 root  wheel  1,073,741,824 Oct 23 01:30 /var/vm/sleepimage 
                                           16GB RAM MacOS 12.0  7/27/21
 highstandbythreshold 50
 displaysleep         28
 sleep                1 (sleep prevented by sharingd)
 acwake               0
 halfdim              1
 tcpkeepalive         1
 disksleep            0 
-g custom custom settings for all power sources.
Battery Power:
 lidwake              1
 autopoweroff         1
 standbydelayhigh     86400
 autopoweroffdelay    28800
 standbydelaylow      10800
 standby              1
 proximitywake        0
 ttyskeepawake        1
 hibernatemode        3
 gpuswitch            2
 powernap             1
 hibernatefile /var/vm/sleepimage
 highstandbythreshold 50
 displaysleep         28
 sleep                1
 acwake               0
 halfdim              1
 tcpkeepalive         1
 disksleep            0

 lessbright           0
AC Power:
1
1
86400 
28800
10800
1 
1
1
3 
2
1

50
180
1
0
1
1
0


 networkoversleep     0
 womp                 1
-g cap which power management features the machine supports.
 
# While on Battery power
pmset -g cap 
Capabilities for Battery Power:
 displaysleep
 disksleep
 sleep
 acwake
 lidwake
 lessbright
 halfdim
 gpuswitch
 standby
 standbydelayhigh
 standbydelaylow
 highstandbythreshold
 powernap
 ttyskeepawake
 hibernatemode
 hibernatefile
 autopoweroff
 tcpkeepalive
 autopoweroffdelay
 proximitywake 
11/08/22 macBook Pro 14", 2021 Apple M1 Pro 
Ventura 13.0
pmset -g cap # while on A/C   
Capabilities for AC Power:    
 displaysleep
 disksleep
 sleep
 womp
 standby
 powernap
 ttyskeepawake
 hibernatemode
 hibernatefile
 tcpkeepalive
 lowpowermode





     
-g sched scheduled startup/wake and shutdown/sleep events. Some in the far future!!
Scheduled power events:
[0] wake at 07/27/21 23:00:00 
            by 'com.apple.alarm.user-visible-com.apple.donotdisturb.server.ScheduleLifetimeMonitor.timer' 
            User visible: true 
[1] wake at 10/25/23 09:00:00 
            by 'com.apple.alarm.user-visible' 
            User visible: true
…
[31] wake at 10/25/23 09:00:00 
            by 'com.apple.alarm.user-visible-com.apple.remindd.today-notification' 
            User visible: true
…
[73] wake at 10/25/23 10:15:00 
            by 'com.apple.alarm.user-visible-com.apple.remindd.time-alarm' 
            User visible: true
-g ups UPS emergency thresholds.
-g ps | batt status of batteries and UPSs.
pmset -g ps 
Now drawing from 'Battery Power'
 -InternalBattery-0 (id=10420323)   46%; discharging; 4:32 remaining present: true
-g pslog displays an ongoing log of power source (battery and UPS) state. outputs every minute.
pmset -g pslog
Logging IORegisterForSystemPower sleep/wake messages
pmset is in logging mode now. Hit ctrl-c to exit.
2020-10-23 11:17:52 -0400 IOPSNotificationCreateRunLoopSource
Now drawing from 'Battery Power'
 -InternalBattery-0 (id=10420323)   45%; discharging; 4:22 remaining present: true
…
2020-10-23 12:05:58 -0400 com.apple.system.powersources.timeremaining
2020-10-23 12:05:58 -0400 com.apple.system.powersources.percent
2020-10-23 12:05:58 -0400 com.apple.system.powersources
2020-10-23 12:05:58 -0400 IOPSNotificationCreateRunLoopSource
 -InternalBattery-0 (id=10420323)   79%; charging; 1:25 remaining present: true
-g rawlog an ongoing log of battery state as read directly from battery.
pmset -g rawlog
pmset is in RAW logging mode now. Hit ctrl-c to exit.
 * Battery matched at registry = 7427
10/23/20 12:09:03
 AC; Charging; 76%; Cap=4312: FCC=5627; Design=6559; 
    Time=1:19; 1991mA; Cycles=993/1000; Location=0; 
    Polled boot=10/21/20 18:57:35; 
    Full=10/23/20 12:08:58; 
    User visible=10/23/20 12:07:58
-g assertions a summary of power assertions. Assertions may prevent system sleep or display sleep. Available
pmset -g assertions
2020-10-23 12:10:58 -0400 
Assertion status system-wide:
   BackgroundTask                 0
   ApplePushServiceTask           0
   UserIsActive                   1
   PreventUserIdleDisplaySleep    0
   PreventSystemSleep             0
   ExternalMedia                  0
   PreventUserIdleSystemSleep     1
   NetworkClientActive            0
Listed by owning process:
   pid 206(hidd): 
    [0x000124ba000998c8] 00:00:00 UserIsActive 
            named: "com.apple.iohideventsystem.queue.tickle 
        serviceID:10000623b name:AppleHIDKeyboardEve 
        product:Apple Internal Keyb eventType:3"  
    Timeout will fire in 10800 secs Action=TimeoutActionRelease
 pid 5962(UserEventAgent): 
    [0x00015ec2000ba2d3] 00:33:43 BackgroundTask 
            named: "com.apple.parsec-fbf.flush"  
    Created for PID: 13555. 
 pid 400(mds_stores): 
    [0x000166a9000ba346] 00:00:00 BackgroundTask 
            named: "com.apple.metadata.mds_stores.power"  
 pid 6014(sharingd): [0x000165470001a323] 00:05:54 PreventUserIdleSystemSleep 
            named: "Handoff"  
Kernel Assertions: 0x100=MAGICWAKE
   id=503  level=255 0x100=MAGICWAKE mod=10/23/20, 11:38 AM description=llw0 
                                    owner=IOSkywalkNetworkBSDClient
   id=504  level=255 0x100=MAGICWAKE mod=10/23/20, 11:37 AM description=en0 
                                    owner=en0
                Idle sleep preventers: IODisplayWrangler
-g assertionslog shows a log of assertion creations and releases.
-g sysload the "system load advisory" - a summary of system activity available from the IOGetSystemLoadAdvisory
pmset -g sysload   
2020-10-23 12:12:22 -0400 
  combined level = OK
  - user level = OK
  - battery level = Great
  - thermal level = Great
-g sysloadlog an ongoing log of lives changes to the system load advisory.
-g ac / adapter will display details about an attached AC power adapter.
pmset -g ac        
 Wattage = 60W
 SourceID = 0x0001
 Current = 3650mA
 Voltage = 16500mV
 AdapterID = 2337
 Family Code = 0x0085
 Serial Number = 0x012e0d04
-g log a history of sleeps, wakes, and other power management events.
-g uuid the currently active sleep/wake UUID; correlate sleep/wake activity within one sleep cycle. history
pmset -g uuid
FC7437D8-F463-4D42-BB71-A30281DC7D11
-g uuidlog the currently active sleep/wake UUID, and outputs a new UUID as they're set by the system.
pmset -g uuidlog
Logging IORegisterForSystemPower sleep/wake messages
Logging UUID changes.
2021-07-24 21:34:39 -0400 FC7437D8-F463-4D42-BB71-A30281DC7D11
2021-07-24 21:34:57 -0400 Cleared.
------close lid---
2021-07-24 21:34:57 -0400 AC15D5EA-0D47-4A8F-99F1-E04718A870D4

2021-07-24 21:34:57 -0400 IORegisterForSystemPower: ...Sleeping...

2021-07-24 21:35:01 -0400 IORegisterForSystemPower: ...HasPoweredOn...
  Wake Reason = SPIT
  wakeType = UserActivity Assertion 
-g history debugging . outputs a timeline of system sleeplwake UUIDs, when enabled with boot-arg io=0x3000000.
pmset -g history
Error - no power history found. (IOPMCopyPowerHistory error = 0xe00002bc)
-g historydetailed outputs driver-level timings for a sleep/wake. Pass a UUID as an argument.
-g powerstate [class names] outputs the current power states for I/O Kit drivers. Caller may provide one or more I/O Kit if no classes are provided, it will output all drivers' power states. class names (separated by spaces) as an argument.
pmset -g powerstate 
   == Apple



IOPMrootDomain       4  ON
FDEKeyStore         1  ON
SSE                 1  ON
ACPIPCI             3  ON
IntelFramebuffer    2  USEABLE
IntelFramebuffer    2  USEABLE
BacklightDisplay    3  USEABLE
HDAController       2  USEABLE
IntelLpssDmac       1  ON
IntelLpssGspi       1  ON
IntelLpssSpiControl 1  ON
There are many duplicate entries (sic)

HSSPIController     2  USEABLE

HSSPIHIDDriver  2  LOW_POWER
HSSPIHIDDriver  2  USEABLE
HSSPIHIDDriver  2  USEABLE
HSSPIHIDDriver  2  LOW_POWER
HSSPIHIDDriver  2  LOW_POWER
HSSPIHIDDriver  2  USEABLE
HSSPIHIDDriver  2  LOW_POWER
HSSPIHIDDriver  2  LOW_POWER
HSSPIHIDDriver  2  USEABLE
HSSPIHIDDriver  2  LOW_POWER
HSSPIHIDDriver  2  LOW_POWER
HSSPIHIDDriver  2  USEABLE
HSSPIHIDDriver  2  USEABLE
HSSPIHIDDriver  2  LOW_POWER
HSSPIHIDDriver  2  LOW_POWER
HSSPIHIDDriver  2  USEABLE
HSSPIHIDDriver  2  LOW_POWER


IntelMEIDriver      1  ON
MEClientController  1  USEABLE
HDAController       2  USEABLE
HDADriver           1  USEABLE
CamIn               0  None
ThunderboltHAL      0  None
IOThunderboltController  0 None
IOThunderboltSwitchType2 0 None
AHCI                2  USEABLE
LPC                 1  USEABLE
SMC                 1  USEABLE
LMUController       1  ON
SmartBatteryManager 1  ON
RTC                 2  None
USBLegacyRoot       4  USEABLE
SystemPolicy        1  ON
com__driver_AppleUS 2  None
com__driver_AppleUS 0  None
X86PlatformPlugin    1  USEABLE
IPAppender          1  ON
IODisplayWrangler    4  USEABLE 
-g powerstatelog [-i interval] [classNames] Periodically outputs the power state residency times for some drivers.
idefault IOPower plane's root registry entry.
default 5 seconds. Sample compressed
Polling at 5 secs interval

2021-07-27 20:24:32 -0400                                      Entries
 Driver       Time[0] [1]   [2]   [3] Time[4]         [0]   [1]   [2]   [3]   [4] 
IOPMrootDomain   0     0     0     0  *0x12a366e6a     0     0     0     0     0
IOPMrootDomain   0     0     0     0  *0x12a5be521     0     0     0     0     0
IOPMrootDomain   0     0     0     0  *0x12a20ef56     0     0     0     0     0


-g stats outputs number sleeps and wakes since boot.
pmset -g stats  
Sleep Count:118
Dark Wake Count:109
User Wake Count:12
-g systemstate outputs the current power state of the system and available capabilites.
 pmset -g systemstate
Current System Capabilities are: CPU Graphics Audio Network 
Current Power State: 4
export log=`date +/var/log/pmsets_%y%m%d.%H%M` 
sudo touch $log
sudo chmod g+w $log
sudo chgrp staff $log
sudo pmset -g everything   > $log 
vi $log
or
pmset -g everything |more 
outputs from every argument under the GETTING header. Large dispay.

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 default on desktops. not saving memory up to persistent storage, must wake from the contents of memory;
Loses context on power loss. This is sleep.
hibernatemode = 3 default on portables. stores memory to persistent storage (the disk), and powers memory during sleep.
Wakes from memory, unless a power loss forces it to restore from hibernate image.
hibernatemode = 25 is only settable via pmset. copy memory to persistent storage and removes memory power .
Restores from disk image.
"hibernation" - slower sleeps, slower wakes, and better battery life, hibernatefile file must be located on the root volume.

Setting

Specify one or more setting value pairs.
The settings apply to all, battery, charger or UPS .-a, -b, -c, -u
Zero minutes for the idle time disables disksleep & displaysleep

lidwake 1| 0wake the machine when the laptop lid (or clamshell) is opened
autopoweroff| 0
standbydelayhigh n
standbydelayhlow n
autopoweroffdelay n
standby 0| 1
proximitywake 1| 0 controls system wake from sleep based on proximity of devices using the same iCloud id.
ttyskeepawake 1|prevent idle system sleep when any tty (e.g. remote login session) is 'active'. A tty is 'inactive' when its idle time exceeds the system sleep timer.
hibernatemode nhibernation mode. use caution.
gpuswitch 0| 1 |2
powernap 1| 0enable/disable Power Nap
hibernatefile pathhibernation image file location. Image may only be located on the root volume. use caution. (value = path)
hibernatethreshold n
displaysleep 0 | minutes sleep timer for the display (screen).
sleep 0 |minutessystem sleep timer
acwake 1| 0wake when power source (AC/battery) is changed
womp 1| 0wake on ethernet magic packet. Same as "Wake for network access" in the Energy Saver preferences.
ring 1| 0wake on modem ring
autorestart 1| 0automatic restart on power loss
lessbright 1| 0slightly turn down the display brightness when switching to this power source (value = 0/1)
halfdim 1| 0the display sleeps using half-brightness
sms 1| 0use Sudden Motion Sensor to park disk heads on sudden changes in G force
networkoversleepaffects how networking presents shared network services during system sleep.
destroyfvkeyonstandby 1| 0Destroy File Vault Key when going to standby mode. By default File vault keys are retained
If the keys are destroyed, user will be prompted to enter the password while coming out of standby mode.
tcpkeepalive 0| 1
disksleep 0 | minutesdisk spindown timer

STANDBY ARGUMENTS

standby hibernate after it has slept for a specified time period. This setting defaults to ON for supported hardware. The setting standby will be visible in pmset -g if the feature is supported on this machine.
standbydelay specifies the delay, in seconds, before writing the hibernation image to disk and powering off memory for Standby.
autopoweroff is enabled by default on supported platforms as an implementation of Lot 6 to the European Energy-related Products Directive. After sleeping for seconds, the system will write a hibernation image and go into a lower power chipset sleep. Wakeups from this state will take longer than wakeups from regular sleep.
autopoweroffdelay the delay, in seconds, before entering autopoweroff mode.

UPS SPECIFIC ARGUMENTS

UPS-specific arguments are only valid following the -u option. UPS settings also have an on/off value. Use a -1 argument instead of percent or minutes to turn any of these settings off. If multiple halt conditions are specified, the system will halt on the first condition that occurs in a low power situation.
haltlevel when draining UPS battery, battery level at which to trigger an emergency shutdown (value in %)
haltafter when draining UPS battery, trigger emergency shutdown after this long running on UPS power (value in minutes, or 0 to disable)
haltremain when draining UPS battery, trigger emergency shutdown when this much time remaining on UPS power is esti- mated (value in minutes, or 0 to disable) Note: None of these settings are observed on a system with support for an internal battery, such as a laptop. UPS emer- gency shutdown settings are for desktop and server only.

SCHEDULED EVENT ARGUMENTS

Schedule system sleep, shutdown, wakeup and/or power on.
schedule is for setting up one-time power events,
repeat is for setting up daily/weekly power on and power off events.
you may only have one pair of repeating events scheduled - a "power on" event and a "power off" event.
For sleep cycling applications, pmset can schedule a "relative" wakeup or poweron to occur in seconds from the end of system sleep/shutdown, but this event cannot be cancelled and is inherently imprecise.
type one of sleep, wake, poweron, shutdown, wakeorpoweron
date/time "MM/dd/yy HH:mm:ss" (in 24 hour format; must be in quotes)
time HH:mm:ss
weekdays subset of MTWRFSU ("M" and "MTWRF" are valid strings)
owner string describing the person or program who is scheduling this one-time power event (optional)
sudo pmset schedule cancelall

POWER SOURCE ARGUMENTS

-g batt or ps will show the state of all attached power sources.
-g pslog or rawlog HUGE used for debugging, such as isolating a problem with an aging battery.
OTHER ARGUMENTS
boot tell the kernel that system boot is complete (normally LoginWindow does this). May be useful to Darwin users.
touch PM re-reads existing settings from disk.
noidle pmset prevents idle sleep by creating a PM assertion to prevent idle sleep(while running; hit ctrl-c to cancel). Deprecated in favor of caffeinate(8).
sleepnow causes an immediate system sleep.
restoredefaults. Restores Energy Saver settings to their default values. (Same as clicking "Restore Defaults" in Energy Saver GUI). Causes the display to go to sleep (blank) immediately.
resetdisplayambientparams. resets the ambient light parameters for certain displays.

Examples

Set displaysleep to a 5 minute timer on battery power,
pmset -b displaysleep 5
Set displaysleep to 10, disksleep to 10, system sleep to 30, and turns on WakeOnMagicPacket for ALL power sources (AC, Battery, and UPS) as appropriate
pmset -a displaysleep 10 disksleep 10 sleep 30 womp 1
Restore the system's energy settings to their default values. For a system with an attached and supported UPS, this instructs the system to perform an emergency shutdown when UPS battery drains to below 40%.
pmset -u haltlevel 40
For a system with an attached and supported UPS, this instructs the system to perform an emergency shutdown when UPS battery drains to below 25%, or when the UPS estimates it has less than 30 minutes remaining runtime. The system shuts down as soon as either of these conditions is met.
pmset -u haltlevel 25 haltremain 30
For a system with an attached and supported UPS, this instructs the system to perform an emergency shutdown after 2 min- utes of running on UPS battery power.
pmset -u haltafter 2
Schedules the system to automatically wake from sleep on July 4, 2016, at 8PM.
pmset schedule wake "07/04/16 20:00:00"
Schedules a repeating shutdown to occur each day, Tuesday through Saturday, at 11AM.
pmset repeat shutdown TWRFS 11:00:00
Schedules a repeating wake or power on event every tuesday at 12:00 noon, and a repeating sleep event every night at 8:00 PM.
pmset repeat wakeorpoweron T 12:00:00 sleep MTWRFSU 20:00:00
outputs the power management settings in use by the system.
pmset -g
outputs a snapshot of battery/power source state at the moment.
pmset -g batt
If your system suddenly sleeps on battery power with 20-50% of capacity remaining, leave this command running in a Terminal window. When you see the problem and later power and wake the computer, you'll be able to detect sudden discontinu- ities (like a jump from 30% to 0%) indicative of an aging battery. pmset -g pslog HUGE

SEE ALSO

caffeinate(8)

FILES

All changes made through pmset are saved in a persistent preferences file (per-system, not per-user) at /Library/Preferences/SystemConfiguration/com.apple.PowerManagement.plist

Scheduled power on/off events are stored separately in /Library/Preferences/SystemConfiguration/com.apple.AutoWake.plist pmset modifies the same file that System Preferences Energy Saver modifies.


caffeinate [-disu] [-t timeout] [-w pid] [utility arguments ]

prevent the system from sleeping on behalf of a utility.

Creates assertions to alter system sleep behavior. If no assertion flags are specified, caffeinate creates an assertion to prevent idle sleep. If a utility is specified, caffeinate creates the assertions on the utility's behalf, and those assertions will persist for the duration of the utility's execution. Otherwise, caffeinate creates the assertions directly, and those assertions will persist until caffeinate exits.

Create an assertion that prevents idle sleeping of the
-d display
-i system
-m disk
-s system valid only when system is running on AC power.
-u declare that user is active.
If the display is off, turns the display on and prevents the display from going into idle sleep.
Default timeout is 5 second .
-t seconds timeout for which this assertion has to be valid, it is dropped afterwards. Timeout value is not used when an utility is invoked with this command.
-w pid Waits pid to exit, then assertion released.
Ignored with utility .

EXAMPLE

Fork a process, execs make in it, and holds an assertion that prevents idle sleep as long as that process is running: caffeinate -i make