All articles

How to Keep Your Mac From Sleeping During a Big Copy

· 5 min read

A big copy to an external drive or a NAS can easily take an hour. Walk away, and macOS may decide the Mac is idle and put it to sleep halfway through. A sleeping Mac copies nothing.

The short answer: keep the Mac awake for exactly as long as the copy runs. You can do it by hand with the caffeinate command in Terminal, by changing the sleep settings while you are plugged in, or by using a file manager that tells macOS it is busy while it copies. Here are the three, from the most manual to the most automatic.

Why a big copy stops when the Mac sleeps

macOS measures idle time from your last keystroke, click or trackpad movement. After the delays set in System Settings, the display turns off and the Mac can then go to sleep. A file copy is not activity in that sense: if the app doing the copy does not explicitly ask macOS to stay awake, idle sleep can start right in the middle of it.

When the Mac sleeps, running programs are suspended. A copy between two local disks simply stops until you wake the Mac, so it is still unfinished when you come back. A copy to a server or a NAS is worse off: network connections often do not survive sleep, and the copy may end with an error.

See what is keeping your Mac awake

Open Terminal and type:

pmset -g assertions

The list shows every request to stay awake (macOS calls them assertions) and the process that made it. PreventUserIdleSystemSleep means "no idle sleep for the Mac", PreventUserIdleDisplaySleep means "keep the display on". In Activity Monitor, the Energy tab also has a column showing which apps prevent sleep. If nothing in that list belongs to your copy, the Mac is free to fall asleep.

Option 1: the caffeinate command in Terminal

caffeinate comes with macOS. It creates the same kind of assertion and keeps it as long as it runs:

  • caffeinate -i keeps the Mac from idle sleeping until you press ⌃ C in that Terminal window.
  • caffeinate -i -t 7200 does the same for 7,200 seconds (two hours), then lets go.
  • caffeinate -d keeps the display on as well; caffeinate -s prevents sleep only while the Mac is on its power adapter.
  • caffeinate -i ditto ~/Movies/Project "/Volumes/Travel SSD/Project" runs the copy itself and stays awake until it finishes, then releases the Mac.

The last form is the cleanest: no timer to guess. The catch is that you have to remember to start it, keep that Terminal window open, and copy from the command line rather than from the Finder.

Option 2: change the sleep settings

If you would rather not touch Terminal, you can stop the Mac from sleeping on its own while it is plugged in:

  • MacBook: System Settings › Battery › Options…, the option that prevents automatic sleeping on power adapter when the display is off.
  • Desktop Mac: System Settings › Energy, the option that prevents automatic sleeping when the display is off.
  • Display: System Settings › Lock Screen sets when the display turns off on battery and on power adapter.

Exact labels vary slightly between macOS versions. The downside is that this is permanent: the Mac stays awake every night, not just during your copy, until you switch it back. And on battery, a MacBook still sleeps on its own schedule.

Option 3: a file manager that keeps the Mac awake by itself

The neatest solution is for the app doing the copy to hold the Mac awake while it works, and only then. Utilities such as Amphetamine do this on demand; Folia Files does it automatically for its own operations.

Two panes in Folia Files: the Movies folder on the left, an external disk on the right, ready for a big copy

Automatic during copies, backups and imports

As long as an operation is running in Folia Files (a copy or a move, a backup, a memory card import, a synchronization), the app asks macOS not to idle sleep. The display may still turn off, which saves power; the copy carries on behind it. When the last operation finishes, the request is released and the Mac goes back to its usual sleep settings. In pmset -g assertions it shows up as "Folia Files: an operation is in progress".

It is on by default. To check it, open Folia Files › Settings… (⌘ ,) › Files and Network: in the Copies section, the switch is Keep the Mac awake during copies, backups and imports.

Folia Files settings, Files and Network page: the Copies section with the switch that keeps the Mac awake during copies, backups and imports

Right above it sits a useful companion: Resume a copy interrupted by the network or an unplugged disk automatically. If a copy is cut anyway (a NAS that drops, a cable pulled out), Folia Files waits for the volume to come back and picks up where it stopped instead of starting over.

On demand from the menu bar

Sometimes the copy is not the only thing: a long download, a render, a presentation. Folia Files' menu bar item has Keep the Mac Awake, with For 30 Minutes, For 1 Hour, For 2 Hours, For 4 Hours and Until I Stop It. This one keeps the display on too.

While it is active, the menu shows Mac Kept Awake with the time left; click it to let the Mac sleep again. When an operation is what holds the Mac awake, the menu says so: Awake until the current operations finish. The menu bar item is shown by default; if you hid it, it comes back with Show Folia Files in the menu bar in Settings › Menu Bar.

Website and App Store editions

Keeping the Mac awake works the same in both editions: macOS lets any app, sandboxed or not, make this request without a special permission. In the App Store edition, synchronizations need the free Folia Files Companion; copies, moves, backups and card imports do not.

What no app can prevent: closing the lid

Closing a MacBook's lid puts it to sleep, whatever caffeinate or any app says. The exception is closed-display mode: the Mac is on its power adapter and connected to an external display, keyboard and mouse or trackpad. Without that setup, leave the lid open. The screen can go dark on its own; the copy keeps running.

Checklist before a big copy

  • Plug in your MacBook: on battery, sleep settings are stricter and a long copy drains it.
  • Leave the lid open, unless you are using an external display.
  • Start the copy in an app that keeps the Mac awake, or prefix your command with caffeinate -i.
  • Not sure? Run pmset -g assertions and look for your copy.
  • Once it is done, eject the drive properly. If macOS says it is still in use, here is how to eject a disk that says it's in use.