Disable macOS Sleep using Terminal

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

man caffeinate

Thanks for reading!

David

Leave a Reply

Your email address will not be published. Required fields are marked *