Set the Idle-Sleep Timer with systemsetup

Set exactly how many minutes of inactivity pass before the Mac sleeps, from the command line, and read the current value back.

macOSsystemsetupsleepPower & SleepMedium risk
Run sudo systemsetup -setcomputersleep 15 to make the Mac sleep after 15 idle minutes; a value of 0 means never sleep.

01Command

Command
$ sudo systemsetup -setcomputersleep 15 && sudo systemsetup -getcomputersleep

02What it does

systemsetup is the automation-friendly twin of the Energy Saver pane: it writes the same idle timer but is scriptable over SSH, which makes it ideal for lab machines and headless Mac minis. -getcomputersleep echoes back the stored number of minutes so you can confirm the change, and 0 disables idle sleep entirely.

03Risk

RiskMedium risk
RequirementsRequires an administrator password.
!Warning: On Apple Silicon Macs systemsetup may refuse without proper admin authorization, and the display has its own separate timer set via pmset displaysleep.

04Undo

Undo
$ sudo systemsetup -setcomputersleep 0

05Sources

  • systemsetup - Set System Configuration Preferences
    SS64 · technical · 2026-09-17
    Evidence: Documents -setcomputersleep minutes (0 = never) and -getcomputersleep for reading the current idle-sleep timer.
  • systemsetup(8) man page
    manpagez.com · technical · 2026-09-17
    Evidence: The systemsetup man page describes -setcomputersleep as setting the system sleep amount in minutes and -getcomputersleep as displaying it.

Last verified: 2026-09-19 · Category: System & Settings

06Related solutions