Prevent MacBook from sleeping using caffeinate

2 September 2025 - Thomas Damgaard

I recently had to rsync a large amount of data that would take several hours. My MacBook kept going to sleep so the rsync would never finish.

I learned about the caffeinate utility to prevent sleeping.

Usage examples are:

caffeinate rsync -vaP /path/to/source /path/to/destination

This keeps your Mac awake only for the duration of the rsync process. Once the transfer is complete, caffeinate will end, and your computer will resume its normal power-saving behavior.

If you wanted to keep the screen on for some reason (e.g., to monitor the progress), you would use the -d (display) flag.

caffeinate -d rsync -vaP /path/to/source /path/to/destination

If you just want to keep Mac running without waiting for some specific command:

caffeinate -t 36000

This command keeps the Mac awake for 10 hours (3600 seconds * 10 = 36000).

Filed under: apple, howto, macos, tips

Back to article list