Forrest logo
back to the caffeinate tool

caffeinate:tldr:59abc

caffeinate: Prevent from sleeping until a command completes.
$ caffeinate -s "${command}"
try on your machine

The command "caffeinate -s" is used to prevent a Mac from going to sleep or idle mode while running a specific task. The "-s" option tells caffeinate to prevent idle sleep only, without preventing display sleep.

In the command you provided, "${command}" is a placeholder for any command or script that you want to run while preventing the Mac from sleeping. You would need to replace "${command}" with the actual command you want to run. For example, if you want to prevent sleep while running a Python script called "script.py", the command would be:

caffeinate -s python script.py

This command will keep the Mac awake until the Python script completes or the caffeinate process is manually terminated.

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