pmset- manipulate power management settings

pmset [-a |b | -c | -u] [setting value] [...]
pmsetu [haltlevel percent] [haltafter minutes] [haltremain minutes]
pmsetg [option]
pmset schedule [cancel] type date+time [owner]
pmset repeat cancel
pmset repeat type weekdays time
pmset relative wake seconds
pmset [touch | sleepnow | noidle | lock | boot]

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

Flags determine whether the settings apply to battery (-b ), charger (wall power) ( -c ), UPS ( -u ) or all ( -a ).

A minutes argument of 0 to sets the idle time to never for sleep disksleep and displaysleep

root access required to modify settings.

displaysleep display sleep timer; (minutes, 0 to disable)
disksleep disk spindown timer; (minutes, 0 to disable)
sleep system sleep timer (minutes, 0 to disable)
womp wake on ethernet magic packet (value = 0/1)
ring wake on modem ring (0/1)
autorestart automatic restart on power loss (= 0/1)
powerbutton sleep when power button is pressed (value = 0/1)
lidwake wake when the laptop lid (or clamshell) is opened (value = 0/1)
acwake wake when power source (AC/battery) is changed (value = 0/1)
lessbright slightly turn down display brightness when switching to this power source (value = 0/1)
halfdim display sleep will use an intermediate half-brightness state between full brightness and fully off (value = 0/1)
sms use Sudden Motion Sensor to park disk heads on sudden changes in G force (value = 0/1)
hibernatemode change hibernation mode. (integer)
hibernatefile change hibernation image file location. Image may only be located on the root volume. (path)
ttyskeepawake prevent idle system sleep when any tty (e.g. remote login session) is 'active'. A tty is 'inactive' only when its idle time exceeds the system sleep timer. (value = 0/1)
networkoversleep affects how OS X networking presents shared network services during system sleep. not used by all platforms; changing its value is unsupported.
destroyfvkeyonstandby Destroy File Vault Key when going to standby mode. By default File vault keys are retained even when system goes to standby. If the keys are destroyed, user will be prompted to enter the password while coming out of standby mode.(value: 1 Destroy, 0 Retain)

-g options

examples as of Mavericks 11/26/15
no argument,
live
the settings in use.
Active Profiles:
Battery Power       1
AC Power        -1*
Currently in use:
 womp                 1
 halfdim              1
 sms                  1
 hibernatefile        /var/vm/sleepimage
 networkoversleep     0
 disksleep            10
 sleep                60 (sleep prevented by apsd)
 hibernatemode        3
 ttyskeepawake        1
 displaysleep         60
 acwake               0
 lidwake              1
customcustom settings for all power sources. rearranged for better viewing ed
Battery Power:
 lidwake              1 ttyskeepawake 1    hibernatemode 3   hibernatefile /var/vm/sleepimage
 displaysleep         5 sleep         5    acwake        0
 halfdim              1 sms           1    lessbright    1   disksleep   5
AC Power:
 lidwake              1 ttyskeepawake 1    hibernatemode 3   hibernatefile /var/vm/sleepimage
 displaysleep         60 sleep       60    acwake        0
 halfdim              1 sms           1                      disksleep  10
 womp                 1 networkoversleep     0
cappower management capibilities supported. (see live above
Example:
Capabilities for AC Power:
 displaysleep disksleep sleep womp acwake lidwake halfdim sms ttyskeepawake hibernatemode hibernatefile
schedscheduled startup/wake and shutdown/sleep events.
upsUPS emergency thresholds.
Example:
UPS settings: haltlevel off 0; haltafter off 0;  haltremain off 0
ps / batt status of batteries and UPSs.
Example:
Now drawing from 'AC Power'
 -InternalBattery-0 99%; charged; 0:00 remaining present: true


pslogongoing log of power source (battery and UPS) state.
Logging IORegisterForSystemPower sleep/wake messages
pmset is in logging mode now. Hit ctrl-c to exit.
2016-02-29 20:44:34 -0500 IOPSNotificationCreateRunLoopSource
Now drawing from 'Battery Power'
 -InternalBattery-0 99%; discharging; (no estimate) present: true
2016-02-29 20:44:39 -0500 com.apple.system.powersources
2016-02-29 20:44:43 -0500 com.apple.system.powersources.timeremaining
2016-02-29 20:44:43 -0500 IOPSNotificationCreateRunLoopSource
Now drawing from 'AC Power'
 -InternalBattery-0 99%; charged; 0:00 remaining present: true
2016-02-29 20:44:43 -0500 com.apple.system.powersources.lowbattery
2016-02-29 20:44:43 -0500 com.apple.system.powersources.percent
2016-02-29 20:44:43 -0500 com.apple.system.powersources.source
2016-02-29 20:44:43 -0500 com.apple.system.powersources
2016-02-29 20:44:43 -0500 com.apple.system.powersources.lowbattery
2016-02-29 20:44:43 -0500 com.apple.system.powersources
2016-02-29 20:44:57 -0500 com.apple.system.powersources.timeremaining
2016-02-29 20:44:57 -0500 IOPSNotificationCreateRunLoopSource
Now drawing from 'Battery Power'
 -InternalBattery-0 99%; discharging; (no estimate) present: true
2016-02-29 20:44:57 -0500 com.apple.system.powersources.percent
2016-02-29 20:44:57 -0500 com.apple.system.powersources.source
2016-02-29 20:44:57 -0500 com.apple.system.powersources

2016-02-29 20:45:09 -0500 IORegisterForSystemPower: ...Sleeping...
2016-02-29 20:45:13 -0500 com.apple.system.powersources.lowbattery
2016-02-29 20:45:13 -0500 com.apple.system.powersources

2016-02-29 20:45:17 -0500 IORegisterForSystemPower: ...HasPoweredOn...
  Wake Reason = EC LID0
  wakeType = HID Activity
2016-02-29 20:46:13 -0500 com.apple.system.powersources
2016-02-29 20:47:13 -0500 com.apple.system.powersources.timeremaining
2016-02-29 20:47:13 -0500 IOPSNotificationCreateRunLoopSource
 -InternalBattery-0 98%; discharging; 3:29 remaining present: true  
rawlogongoing log of battery state as read directly from battery.
pmset is in RAW logging mode now. Hit ctrl-c to exit.
 * Battery matched at registry = 11523
02/29/16 20:47:10
 No AC; Not Charging; 98%; Cap=4413: FCC=4486; Design=5770; Time=3:32; -1248mA; Cycles=592/1000; Location=0; 
 Polled boot=02/29/16 09:27:52; Full=02/29/16 20:45:13; User visible=02/29/16 20:46:13
02/29/16 20:47:13
 No AC; Not Charging; 97%; Cap=4391: FCC=4486; Design=5770; Time=3:29; -1263mA; Cycles=592/1000; Location=0; 
 Polled boot=02/29/16 09:27:52; Full=02/29/16 20:45:13; User visible=02/29/16 20:47:13
02/29/16 20:48:13
 No AC; Not Charging; 97%; Cap=4371: FCC=4486; Design=5770; Time=3:36; -1215mA; Cycles=592/1000; Location=0; 
 Polled boot=02/29/16 09:27:52; Full=02/29/16 20:45:13; User visible=02/29/16 20:48:13
02/29/16 20:49:13
 No AC; Not Charging; 96%; Cap=4345: FCC=4486; Design=5770; Time=2:58; -1463mA; Cycles=592/1000; Location=0; 
 Polled boot=02/29/16 09:27:52; Full=02/29/16 20:45:13; User visible=02/29/16 20:49:13
thermthermal conditions that affect CPU speed.
Note: No thermal warning level has been recorded
Note: No performance warning level has been recorded
2016-02-29 20:50:59 -0500 CPU Power notify
    CPU_Scheduler_Limit     = 100
    CPU_Available_CPUs  = 2
    CPU_Speed_Limit     = 100
thermloglog of thermal notifications that affect CPU speed.
2016-02-29 20:52:53 -0500 
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 83235(AddressBookSourceSync): [0x00003f3d000107d0] 00:00:25 PreventUserIdleSystemSleep named: "Address Book Source Sync" 
    Timeout will fire in 1774 secs Action=TimeoutActionTurnOff
   pid 105(hidd): [0x0000003f00090172] 23:51:17 UserIsActive named: "com.apple.iohideventsystem.queue.tickle" 
    Timeout will fire in 9958 secs Action=TimeoutActionRelease
No kernel assertions.
Idle sleep preventers: IODisplayWrangler
assertionssummary of power assertions. Assertions may prevent system sleep or display sleep.
2016-02-29 20:52:53 -0500 
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 83235(AddressBookSourceSync): [0x00003f3d000107d0] 00:00:25 PreventUserIdleSystemSleep named: "Address Book Source Sync" 
    Timeout will fire in 1774 secs Action=TimeoutActionTurnOff
   pid 105(hidd): [0x0000003f00090172] 23:51:17 UserIsActive named: "com.apple.iohideventsystem.queue.tickle" 
    Timeout will fire in 9958 secs Action=TimeoutActionRelease
No kernel assertions.
Idle sleep preventers: IODisplayWrangler
assertionsloglog of assertion creations and releases.
2016-02-29 20:52:57 -0500 :Showing all currently held IOKit power assertions
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 83235(AddressBookSourceSync): [0x00003f3d000107d0] 00:00:29 PreventUserIdleSystemSleep named: "Address Book Source Sync" 
    Timeout will fire in 1770 secs Action=TimeoutActionTurnOff
   pid 105(hidd): [0x0000003f00090172] 23:51:21 UserIsActive named: "com.apple.iohideventsystem.queue.tickle" 
    Timeout will fire in 9954 secs Action=TimeoutActionRelease
No kernel assertions.
Idle sleep preventers: IODisplayWrangler

Showing assertion changes(Press Ctrl-T to log all currently held assertions):
02/29 20:52:58   System wide status: PreventUserIdleSystemSleep: 0  
2016-02-29 20:52:58 -0500 :Showing all currently held IOKit power assertions
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 83523(AddressBookSourceSync): [0x00003f5b000107d1] 00:00:00 PreventUserIdleSystemSleep named: "Address Book Source Sync" 
    Timeout will fire in 1800 secs Action=TimeoutActionTurnOff
   pid 105(hidd): [0x0000003f00090172] 23:51:22 UserIsActive named: "com.apple.iohideventsystem.queue.tickle" 
    Timeout will fire in 9954 secs Action=TimeoutActionRelease
No kernel assertions.
Idle sleep preventers: IODisplayWrangler

Time             Action      Type                          PID(Causing PID)    ID                  Name                                              
====             ======      ====                          ================    ==                  ====                                              
02/29 20:52:58   Created     PreventUserIdleSystemSleep    83523               0x3f5b000107d1      Address Book Source Sync                          
02/29 20:53:28   Released    PreventUserIdleSystemSleep    83523               0x3f5b000107d1      Address Book Source Sync                          
02/29 20:53:28   System wide status: PreventUserIdleSystemSleep: 0  
02/29 20:53:28   Created     PreventUserIdleSystemSleep    83776               0x3f7a000107d2      Address Book Source Sync                          
02/29 20:53:28   System wide status: PreventUserIdleSystemSleep: 1  
02/29 20:53:58   Released    PreventUserIdleSystemSleep    83776               0x3f7a000107d2      Address Book Source Sync                          
02/29 20:53:58   System wide status: PreventUserIdleSystemSleep: 0  
02/29 20:53:59   Created     PreventUserIdleSystemSleep    84030               0x3f98000107d3      Address Book Source Sync                          
02/29 20:53:59   System wide status: PreventUserIdleSystemSleep: 1  
02/29 20:54:29   Released    PreventUserIdleSystemSleep    84030               0x3f98000107d3      Address Book Source Sync                          
02/29 20:54:29   System wide status: PreventUserIdleSystemSleep: 0  
02/29 20:54:29   Created     PreventUserIdleSystemSleep    84299               0x3fb6000107d4      Address Book Source Sync                          
02/29 20:54:29   System wide status: PreventUserIdleSystemSleep: 1  
activitysummary of power state of Display wrangler and Disk Queue Manager.
activityloglog of power state changes to Display Wrangler and Disk Queue Manager.
sysload"system load advisory" a summary of system activity available from the IOGetSystemLoadAdvisory API.
2016-02-29 20:57:28 -0500 
  combined level = OK
  - user level = OK
  - battery level = OK
  - thermal level = Great
sysloadlogongoing log of lives changes to the system load advisory.

ac/adapter details about an attached AC power adapter.
loga history of sleeps, wakes, and other power management events. This log is for admin & debugging purposes.
uuidcurrently active sleep/wake UUID; used within OS X to correlate sleep/wake activity within one sleep cycle. history
E00FA03E-25E9-43E3-9CC5-7A843076BD84
uuidlogcurrently active sleep/wake UUID, and prints a new UUID as they're set by the system.
 > pmset -g uuidlog
Logging IORegisterForSystemPower sleep/wake messages
Logging UUID changes.
2016-05-04 20:13:59 -0400 E00FA03E-25E9-43E3-9CC5-7A843076BD84
2016-05-04 20:14:44 -0400 Cleared.   (LID closed)
2016-05-04 20:14:44 -0400 DB54706B-9919-4D74-A201-D6A8BFC8F96F 

2016-05-04 20:14:44 -0400 IORegisterForSystemPower: ...Sleeping...  

2016-05-04 20:14:54 -0400 IORegisterForSystemPower: ...HasPoweredOn...
  Wake Reason = EC LID0
  wakeType = HID Activity
2016-05-04 20:18:36 -0400 DB54706B-9919-4D74-A201-D6A8BFC8F96F
2016-05-04 21:04:28 -0400 Cleared.
2016-05-04 21:04:28 -0400 3B1AC142-57CE-4ECD-B5A8-79C59B9864FC

2016-05-04 21:04:29 -0400 IORegisterForSystemPower: ...Sleeping...

2016-05-04 21:04:53 -0400 IORegisterForSystemPower: ...HasPoweredOn...
  Wake Reason = RTC
  wakeType = Alarm
2016-05-04 21:05:03 -0400 Cleared.
2016-05-04 21:05:03 -0400 ED0B158E-72B0-49B1-BBE5-BDDCBCD8F0F1

2016-05-04 21:05:03 -0400 IORegisterForSystemPower: ...Sleeping...

2016-05-05 08:12:51 -0400 IORegisterForSystemPower: ...HasPoweredOn...
  Wake Reason = EC LID0
  wakeType = HID Activity
sleeps waiting for a change

Does not log AC removal!

Exits with rc
130 if interruped by INTR (^C)
131 if quit by QUIT (^\)
134 if killed with ABRT
137 if killed with KILL

historydebugging tool. outputs a timeline of system sleeplwake UUIDs, when enabled with boot-arg io=0x3000000.
historydetailedoutputs driver-level timings for a sleep/wake. Pass a UUID as an argument.

everythingdisplays output from every argument under the GETTING header. (You might want to pipe this to more)

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
0000 0001 (bit 0) enables hibernation;
write memory to hibernation image at sleep time.
On wake (without bit 1 set) resume from the hibernation image.
Bit 0 set (without bit 1 set) write memory and immediately hibernate at sleep time.
0000 0010 with bit 0, maintain system state in memory and leave power on until battery drops below a near empty threshold (quicker wakeup while battery power is available).
Upon nearly emptying the battery, shuts off power and hibernates;
on wake the system will resume from hibernation image
DynamicPager Page-out hibernation preperation for a smaller memory footprint and smaller image.
0000 1000 page out inactive pages
0001 0000 page out aggressively
Avoid modifying hibernation settings. Don't use anything other 0, 3, or 25.
hibernatefile may only point to a file located on the root volume.
hibernatemode = 0 default on desktops.
The system will not backup memory to disk.
The system must wake from the contents of memory; loses context on power loss
hibernatemode = 3 default on portables.
The system will store memory to disk, and will power memory during sleep.
The system will wake from memory, unless a power loss forces restore from disk .
hibernatemode = 25 only settable via pmset.
The system will store memory to disk, and will remove power to memory.
The system restore from disk .
For "hibernation" slower sleeps, slower wakes, and better battery life, use this setting.

Standby Arguments

Standby automatically hibernates after slept for a specified time.
This saves power while asleep. Default:ON , See pmset -g
Standby only if hibernation is mode 3 or 25.

standbydelay seconds before writing the hibernation image and powering off for Standby.

UPS Specific Arguments

None of these settings are observed on a system with for an internal battery, such as a laptop.
Desktop and server only. Valid following -u have an on/off value. Use -1 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.
When draining UPS battery, trigger emergency shutdown
haltlevel p% battery level at value in %)
haltafter m minutes on UPS power (0 to disable)
haltremain m when minutes remaining on UPS power is estimated (0 to disable)

Scheduled Event

schedule set up one-time power events, and
repeat is for setting up daily/weekly events, only one pair is permitted - a "power on" event and a "power off" event.
relative For sleep cycling applications, pmset can schedule a wakeup to occur in seconds from the end of system sleep,
this event cannot be cancelled and is inherently imprecise.
type sleep|wake|poweron|shutdown|wake|poweron
date/time "MM/dd/yy HH:mm:ss" in 24 hour format; must be in quotes)
timeHH:mm:ss
weekdays subset of MTWRFSU Examples: "M" and "MTWRF"
[owner]

Power Source Arguments

-g batt | ps shows the state of all power sources.
A health estimate for the battery is in the form (condition/confidence)

Certain Apple battery calibration tools may temporarily disable battery charging.
Shown in an additional line of output to 'batt' or 'ps' readings, including the pid of the app inducing this behavior.

'ChargeInhibit': 1432

-g pslog | rawlog for debugging, such as isolating a problem with an aging battery.

Other Arguments

boot tell the kernel that boot is complete (normally LoginWindow does this).
force immediately activate these settings. Does not write them to disk, and the settings may easily be overwritten. Useful in circumstances where PM's configd plugin is not to be running.
touch re-read settings from disk.
noidle prevents idle sleep by creating a PM assertion ( SIGINT ctrl-c to interrupt).
sleepnow
resetdisplayambientparams resets the ambient light parameters
dim
displaysleep
spindown
disksleep

EXAMPLES

set displaysleep to a 5 minute timer on battery power, leaving other settings on battery power and other power sources unperturbed.
pmset -b displaysleep 5
Sets 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
Restores the system's energy settings to their default values. For a system with an attached and supported UPS, instruct 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 minutes of running on UPS battery power.
pmset -u haltafter 2
Schedules the system to automatically wake from sleep on July 4, 2009, at 8PM.
pmset schedule wake "07/04/09 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
Prints the power management settings in use by the system.
pmset -g
Prints 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 discontinuities (like a jump from 30% to 0%) indicative of an aging battery.
pmset -g pslog

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 -- prevent the system from sleeping on behalf of a utility

caffeinate [-disu] [-t seconds] [utility] [argument …]

creates assertions to alter system sleep behavior. Defaults 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.

-d display from sleeping.
-i system from idle sleeping.
-m disk from idle sleeping.
-s system from sleeping. only when system is running on AC power.
-u user is active. this option turns the display on and prevents the display from going into idle sleep.
If a timeout is not specified with -t .
-t seconds Specifies the timeout value in seconds. The assertion is dropped after the specified timeout.
Timeout is not used when an utility is invoked with this command.
EXAMPLE caffeinate forks a process, execs "make" in it, and holds an assertion that prevents idle sleep as long as that process is running.
caffeinate -i make