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:
- Open the Terminal application.
- Run the following command to prevent the system from sleeping indefinitely:
caffeinate
- To prevent the system from sleeping for a specific duration, you can use the following command, where
durationis 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:
- Open the Terminal application.
- To prevent the system from sleeping indefinitely, run the following command:
sudo pmset noidle
- To prevent the system from sleeping for a specific duration, you can use the following command, where
durationis specified in seconds:sudo pmset sleep duration
Note: To stop the pmset command, you can simply run sudo pmset sleep 0 in the Terminal.