caffeinate
SafeKeep the Mac awake
caffeinate -i <command>
Prevents sleep while a command runs (or for -t seconds) — protect long copies and builds.
Examples
caffeinate -i rsync -av src/ dst/Stay awake during a copycaffeinate -dKeep the display awake too (Control+C to stop)caffeinate -t 3600Prevent sleep for one hour onlycaffeinate -w 1234Prevent sleep until process 1234 exitscaffeinate -sPrevent system sleep while on AC power
Syntax
caffeinate [-i] [-t sec] [command]
Key points
- -i blocks idle sleep, -d the display, -s system sleep (on AC only) and -m disk sleep.
- When you append a command, the assertion ends when that command exits. Without one it lasts until Control+C.
- It cannot stop the sleep triggered by closing the lid.
When it does not work
- Check it with pmset -g assertions; caffeinate should be listed.
- Started over SSH, it ends when the session drops. Run it inside tmux or screen.
Before you run it
Auto-releases when done.
Used when you see
The same reference, with no signal at all
Every command on this site, held on your device. The app adds 632 more: 1,510 commands and 120 fix flows, searchable with no connection. Free to install, no ads (some content is a one-time purchase).
Get it free on the App Store