Recently, a colleague complained that they had to use an application called “InsomniaX” in order to prevent their training lab MacBooks from going to sleep while the instructor is in pedagogical mode. Well, I informed him that there was an easy way to address this. He just needs to use his UNIX skills! 🙂
Check the value using the Terminal shell (instead of the friendly System Preference):
sudo systemsetup -getcomputersleep
Turn sleep off completely (since you can’t in System Preferences):
sudo systemsetup -setcomputersleep never
I also ran across the built in BSD tool, caffeinate, which allows sleep to be disabled for a specific set of time, usually associated with a service or application.
For more information on this, see the man page
Thanks for reading!