caffeinate

>Usage

The caffeinate command on macOS is used to prevent the system from sleeping. It can keep the display, system, or disk awake based on various options. This command is particularly useful for long-running tasks where you want to ensure the system stays awake without changing power settings.

Note: Most caffeinate commands can run without administrative privileges, but some tasks, especially those affecting system-wide settings, may require sudo. For example: sudo caffeinate -t 3600.

>Synopsis

caffeinate [option] <duration>

>Options

caffeinate

Prevents the system from sleeping as long as the caffeinate command is running.

Example:

Dots

-zsh

caffeinate


The system will stay awake as long as this command runs.

-t

The command -t <seconds> keeps the system awake for a specified duration (in seconds).

Example:

Dots

-zsh

caffeinate -t 3600


Keeps the system awake for 1 hour (3600 seconds).

-d

Prevents the display from sleeping.

Example:

Dots

-zsh

caffeinate -d


The display will remain on as long as the command runs.

-s

Prevents the system from sleeping while a specific command is running.

Example:

Dots

-zsh

caffeinate -s some_command


Prevents the system from sleeping while some_command is running.

-i

Prevents idle system sleep.

Example:

Dots

-zsh

caffeinate -i


The system will not go into idle sleep as long as the command runs.

>Quiz

Progress: Question ? out of ?

Question Title

Page written by Amos Disha