Every caffeinate flag, in plain English
caffeinate ships with macOS. It creates power assertions, which are requests to the system to hold off on a particular kind of sleep. If you run it with no flags, it prevents idle sleep until you stop it.
- -d prevents the display from sleeping.
- -i prevents the system from idle sleeping.
- -m prevents the disk from idle sleeping.
- -s prevents the system from sleeping. Apple notes this is only valid when the Mac is on AC power.
- -u declares that the user is active. If the display is off it turns it on and keeps it from idle sleeping. Without -t, it uses a default timeout of 5 seconds.
- -t seconds drops the assertion after that many seconds. It is not used when you run a command through caffeinate.
- -w PID waits for that process to exit, then releases the assertion. It is ignored when you run a command through caffeinate.
You can also put a command after caffeinate, for example caffeinate -i ./backup.sh. The assertions then last exactly as long as that command runs. Source: caffeinate(8) man page.
Handy examples
caffeinate -d: keep the screen on until you press Control-C.caffeinate -di -t 3600: keep the screen on and stop idle sleep for one hour.caffeinate -s: stop the Mac sleeping while it is plugged in, for example during a long download.caffeinate -i -w 4821: stay awake until process 4821 finishes.
What caffeinate does not do: Teams and Slack status
Keeping a Mac awake and keeping your chat status green are two different things. Teams and Slack decide when you are Away from how long your computer has gone without keyboard or mouse input. caffeinate's -d, -i, -m and -s flags only hold off sleep, so your screen can stay bright while Teams still turns yellow after a few quiet minutes.
The -u flag is the closest thing. Apple documents it as declaring that the user is active and turning the display on, and without -t it only lasts 5 seconds. Apple does not describe it as something chat apps read, so do not count on it to keep your status Available.
More detail in Why Amphetamine and Caffeine will not keep Teams or Slack active, and you can watch the exact Away thresholds with the free Teams Away timer.