Mac users can set the idle time to sleep their systems easily through the energy saver preference panel but current many advance users of OS X are using Command line to the task. This allows the scripting, remote checking and changing idle sleep behavior through SSH and you can also use it to set the idle time requirements beyond what is allowed through the standard System Preference approach.
Exactly we don’t know how long this inactivity period will be before system starts sleeping, to start with terminal from the Applications/utilities/folder and use many of the following commands strings. Sudo is also necessary and you need to enter the administrative password to make any changes to sleep idle behavior
How to set idle time from the command line
The amount of idle time can be set with in minutes before system goes to sleep by using the following syntax. Let use consider an example, here we use 30 it means half an hour of inactivity before mac sleeps. You can replace number 30 with any other in minutes as you desired.
- Sudo systemsetup -setcomputersleep 30
How to turn off system sleep from the command line in OS X
It is possible to disable system sleep due to inactivity from the command line with the similar command used in the upper case by replacing the number with ‘off’ which means never sleep from inactivity. Even you can use never instead of ‘off’.
- Sudo systemsetup -setcomputersleep ‘off’.
How to check current sleep status of Mac system
If you want to know current status of your Mac computer sleep behavior then you can use the command ” getcomputersleep “.
- Sudo systemsetup -getcomputersleep
If the system reports number back then idle minutes to determine when the sleep event occurs which indicates sleep function on. If it feed back off or never then your Mac system will never goes to sleep inactivity.