Energy Settings – Command Line

So, to set the energy settings via the command line, do the following

Open Terminal and type

sudo systemsetup -setsleep never

This tells your Mac to never sleep, ideal for a server, or a machine running digital signage

 

To set the display to sleep after 15 minutes type the following into Terminal

sudo systemsetup -setdisplaysleep 15

 

To set the machine to wake up when being accessed remotely, type the following into Terminal

sudo systemsetup -setwakeonnetworkaccess on

 

The following ensures the machine boots up every Saturday at 10pm, this is so I can run some maintenance tasks

sudo pmset repeat wakeorpoweron S 22:00:00

 

This next command disables the ability to sleep the machine by pressing the power button

sudo pmset powerbutton 0

 

And this last one tells the machine that it should automatically restart after a power failure

sudo pmset autorestart 1