25

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.

pion
  • 4,827
AGamePlayer
  • 1,837
  • 1
    I do things like this often and the copy continues even though the computer puts the screen into sleep, but the processor continues the copy. A copy even over-rides the automatic shutdown/reboot that I have set for 1AM... – Solar Mike Feb 21 '21 at 09:41
  • 3
    "dies" or goes to sleep? – Mazura Feb 21 '21 at 16:18
  • 2
    How do you copy those files? Command line or Finder? – jornane Feb 21 '21 at 17:10

7 Answers7

40

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.

Graham Miln
  • 43,776
12

You can use the freely available app "Amphetamine" from the Mac App Store to keep the Mac awake:

https://apps.apple.com/us/app/amphetamine/id937984704?mt=12

Another similarly free app is "Jiggler":

http://www.sticksoftware.com/software/Jiggler.html

jksoegaard
  • 77,783
9

If you always remain on AC power during the copy and your above Energy Saver settings are indeed accurate, then I can think of no reason why your system would enter idle sleep unless there is some process that specifically forces a sleep at some point. You can check for sleep entry & causes by examining the power management log:

$ pmset -g log

In any case, in order to prevent the system from going to sleep you can acquire a power management assertion with the use of caffeinate(8), which is built in to macOS and accessible via Terminal:

$ caffeinate

The system will not sleep until you exit (via Control + C).

From your description, I suspect that you might not actually be on AC power the whole time and instead are running off the battery. Please double check this first.

pion
  • 4,827
  • Was thinking the same thing. I have my Mac Pro settings similar while copying large files and my Mac always seems to complete the tasks. Although, these commands seem like a great alternative. – Dan Beaulieu Feb 24 '21 at 13:44
3

Plenty of options already here, but just to complete the set…

System Prefs > Desktop & Screen Saver > Screen Saver > Hot Corners…

Choose a corner to Disable Screen Saver & just push your cursor hard into that corner when you want it to stay awake.

I've never actually tried this on a laptop, but I've been using it successfully on Mac Pros for over a decade.

Tetsujin
  • 115,663
2

Happened to me too, I solved by playing audio/video when I don't want to my laptop go to sleep.

Another way use auto click software like http://www.murgaa.com/auto-clicker-mac/

  • 1
    This is exactly what my child has to do on her school-issued Chromebook to keep it from sleeping during breaks because the managed-device controls don't allow disabling the ridiculously short inactivity lock or installing custom applications. ^_^ – R.. GitHub STOP HELPING ICE Feb 22 '21 at 15:28
0
caffeinate

And then CTRL + SHIFT + ESC

When your monitor should be off, but the computer continues to work

BabyBoy
  • 925
0

You can force your laptop to never sleep entirely in terminal:

Display global power settings:
pmset -g

System-wide power settings:
Currently in use:
 lidwake              1
 autopoweroff         1
 standbydelayhigh     86400
 autopoweroffdelay    28800
 proximitywake        1
 standby              1
 standbydelaylow      10800
 ttyskeepawake        1
 hibernatemode        3
 powernap             1
 gpuswitch            2
 hibernatefile        /var/vm/sleepimage
 highstandbythreshold 50
 womp                 0
 displaysleep         10
 networkoversleep     0
 sleep                1 (sleep prevented by sharingd)
 tcpkeepalive         1
 halfdim              1
 acwake               0
 disksleep            10


Then:
To stop sleep entirely:
sudo pmset -a disablesleep 1

To revert, allowing sleep again:
sudo pmset -a disablesleep 0

Edd Growl
  • 2,684