Prevent the system from sleeping on behalf of a utility.
Syntax caffeinate [-disu] [-t timeout] [-w pid] [utility arguments...] Key -d Create an assertion to prevent the display from sleeping. -i Create an assertion to prevent the system from idle sleeping. -m Create an assertion to prevent the disk from idle sleeping. -s Create an assertion to prevent the system from sleeping. This assertion is valid only when system is running on AC power. -u Create an assertion to declare that user is active. If the display is off, this option turns the display on and prevents the display from going into idle sleep. If a timeout is not specified with '-t' option, then this assertion is taken with a default of 5 second timeout. -t timeout Specifies the timeout value in seconds for which this assertion has to be valid. The assertion is dropped after the specified timeout. The timeout value is not used when a utility is invoked with this command. -w pid Wait for the process with the specified pid to exit. Once the the process exits, the assertion is also released. This option is ignored when used with utility option.
Location: /usr/bin/caffeinate
Prevent sleep indefinitely (until the terminal session is closed):
$ caffeinate
Prevent sleep for 1 hour (3600 seconds):
$ caffeinate -u -t 3600
Make caffeinate fork a process, exec "make" in it, and hold an assertion that prevents idle sleep as long as that process is running:
$ caffeinate -i make
“A cup of coffee commits one to forty years of friendship” ~ Turkish Proverb
Local man page: caffeinate - Command line help page on your local machine.
pmset - Power Management settings.
HT101847 - If you see “disk not ejected properly” after your Mac wakes from sleep.
Amphetamine - Free keep-awake utility.
Equivalent Windows command: Awake (PowerToy).