Library / macOS

MAC-003 · Script

Power Settings

Reports or sets power settings used while the Mac is on AC power: system sleep, display sleep, disk sleep, restart after power loss and wake for network access. Only settings you pass are changed.

Version 1.0.0Language bashUpdated November 2026

What it does

A configuration profile from your MDM can override these values.

Requirements

macOS 12 or later, run as root (MDM or RMM default). No prompts.

How to run it

  • Run as: root (sudo in Terminal, or your MDM default)
  • Run from: any MDM or RMM, a LaunchDaemon, or Terminal with sudo
  • Script type: shell script (bash)
  • User interaction: none; the script never prompts
  • Timeout: 10 minutes (longer for app or update installs)

Settings

NameWhat it doesOptionsDefault
modedefault reportreport, applyreport
sleep0 = never
display-sleep0 = never
disk-sleep0 = never
restart-after-power-loss, on, off
wake-on-lan, on, off

Exit codes

  • 0 = Settings match, or were applied
  • 1 = Settings differ (report mode)
  • 2 = Script error

Testing steps

  1. Run it first with the mode set to report on one test device. Nothing is changed in that mode.
  2. Read the log and confirm the planned changes are what you expect.
  3. Run your chosen settings on the same test target and confirm the result.
  4. Check the exit code: 0 = OK, 1 = needs attention, 2 = error (see log), 9 = this copy is past its Valid until date.
  5. Roll out to a small group next, then everyone.

Rollback steps

Report mode changes nothing and logs the current values. Run again with those values to go back.

Version and change log

VersionDateChanges
1.0.0November 2026First release.