caffeinate:tldr:e2354
The "caffeinate" command is a utility provided by macOS (formerly OS X) that prevents the system from entering sleep mode, screen saver mode, or idle mode temporarily.
When you execute the "caffeinate" command in the Terminal, it activates a power management assertion, keeping your Mac awake for a specified duration or until you manually terminate the command. This can be useful if you want to prevent your Mac from going to sleep during a long process or while you are away but want to keep it active.
The basic syntax for the "caffeinate" command is:
caffeinate [options] [command]
The available options for this command are:
- "-d", "--display" : Prevents the display from sleeping.
- "-s", "--system" : Prevents the system from sleeping.
- "-w", "--idle" : Prevents the system from idle sleeping.
- "-i", "--iohold" : Prevents the system from sleeping solely because of user inactivity.
You can also combine different options to customize the behavior according to your needs. For example, if you want to prevent the display and system from sleeping, you can use the following command:
caffeinate -ds
Furthermore, you can specify a specific timeout duration in seconds by using the "-t" option followed by the desired time. For instance, to keep your Mac awake for 1 hour (3600 seconds), you can use:
caffeinate -t 3600
After executing the command, your Mac will stay awake until the timeout is reached or until you manually terminate the process by pressing "Ctrl + C" in the Terminal.
Overall, the "caffeinate" command is a useful tool to temporarily disable sleep modes on macOS, providing control over system idle behavior during certain tasks or user absence.