Forrest logo
back to the caffeinate tool

caffeinate:tldr:e2354

caffeinate: Prevent desktop from sleeping (use `Ctrl + C` to exit).
$ caffeinate
try on your machine

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.

This explanation was created by an AI. In most cases those are correct. But please always be careful and never run a command you are not sure if it is safe.
back to the caffeinate tool