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.
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 -getcomputersleep02What 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
!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 005Sources
- systemsetup - Set System Configuration PreferencesEvidence: Documents -setcomputersleep minutes (0 = never) and -getcomputersleep for reading the current idle-sleep timer.
- systemsetup(8) man pageEvidence: 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