How to Prevent & Disable Mac OS X From Sleeping From the Command Line Terminal Application

To prevent and disable Mac OS X from sleeping from the Command Line Terminal application, you can use the caffeinate command.

Here’s how to use caffeinate:

  1. Open the Terminal application.
  2. Run the following command to prevent the system from sleeping indefinitely:
    caffeinate
  3. To prevent the system from sleeping for a specific duration, you can use the following command, where duration is specified in seconds:
    caffeinate -t duration

Note: To stop caffeinate, you can simply press CTRL + C in the Terminal.

Alternatively, you can use the pmset command to prevent the system from sleeping:

  1. Open the Terminal application.
  2. To prevent the system from sleeping indefinitely, run the following command:
    sudo pmset noidle
  3. To prevent the system from sleeping for a specific duration, you can use the following command, where duration is specified in seconds:
    sudo pmset sleep duration

Note: To stop the pmset command, you can simply run sudo pmset sleep 0 in the Terminal.

Leave a Comment