Skip to main content

Prevent macOS from sleeping.

# To prevent from sleeping for 1 hour (3600 seconds):
caffeinate -u -t <3600>

# To prevent from sleeping until a command completes:
caffeinate -s "<command>"

# To prevent from sleeping until a process with the specified PID completes:
caffeinate -w <pid>

# To prevent from sleeping (use 'Ctrl + C' to exit):
caffeinate -i

# To prevent disk from sleeping (use 'Ctrl + C' to exit):
caffeinate -m