MacOS – way to prevent the Mac from sleeping during a file copy

macospower-managementsleep-wake

I'm copying a lot of files (over 700 GB) and it takes hours to complete. Is there a way to keep the Mac from sleeping before the copy process completes? I don't want to sit by the computer and moving my mouse from time to time.

I tried to set my Energy Saver settings as:

Energy Saver settings showing sleep disabled

But sometimes it still dies. So currently, I have to sit by the laptop and wait.

Best Answer

caffeinate rsync

Consider using the command line tool rsync to safely copy large amounts of data on your Mac. Prefix the command with caffeinate to keep your Mac awake during the copy.

The Terminal.app command will look something like:

 sudo caffeinate rsync -vaE --progress /Volumes/SourceName /Volumes/DestinationName

rsync has the benefit of being able to resume failed or interrupted copies.

If the copy has already begun, run caffeinate with the flag -t <seconds> for a specific duration or -w <pid> for the life time of a specific process.