Keep your Mac awake while downloading a large file
You kick off a 40 GB download — an OS installer, a game, a dataset — and leave it running overnight. In the morning it's stalled at 60%, because the Mac idled into sleep and dropped the connection. The download itself doesn't need the screen; it needs the system to stay awake. Run caffeinate -i and macOS keeps working with the display off until the transfer is done.
Prevent the sleep that pauses transfers
Use -i, which blocks idle system sleep — the state that suspends running processes and cuts the network. Crucially, it lets the display switch off, so an overnight download runs in a dark, quiet, low-power state while the bytes keep arriving.
# Keep downloading with the screen off; Ctrl-C to stop
caffeinate -i
Start it in a Terminal tab before you walk away. The screen can sleep, the fans stay quiet, and the download proceeds. In the morning, press Ctrl-C and your Mac is back to its normal habits — you've changed nothing permanent.
Bound it to the overnight window
You don't want caffeinate holding the Mac awake all of the next day if you forget it. Give it a timeout roughly the length of a night so it releases itself by morning.
# Stay awake ~8 hours (28800 seconds), then release
caffeinate -i -t 28800
The -t value is seconds — 28800 is eight hours, 14400 is four. Estimate generously from the download size and your connection speed so the timer outlasts the transfer rather than cutting it short.
Better still, tie it to the download itself
If you download from the command line — curl, wget, brew, an installer script — hand the whole thing to caffeinate. It stays awake for precisely as long as the transfer runs and releases the instant it completes, with no timer to estimate.
# Awake only while this download runs, then sleep normally
caffeinate -i curl -O https://example.com/big-file.zip
This is the tidiest option for a scripted download: wakefulness and the task share the exact same lifetime.
Two gotchas for overnight runs
- On battery, use
-i, not-s. The-sflag forces full system awake but only takes effect on AC power — on battery it's silently ignored. For an unattended overnight download you'll want to be plugged in anyway, but-iis the flag that behaves the same either way. - There's no defaults key for this. The only System Settings route is the coarse sleep timers under Battery → Options and Lock Screen — for example "Prevent automatic sleeping when the display is off" on a plugged-in Mac. Those change your Mac's behaviour every night, not just for this one download, which is why a per-run caffeinate is cleaner.
If the transfer is an App Store or macOS update rather than a file you started in Terminal, keeping the Mac awake still helps — the same -i assertion prevents the idle sleep that would otherwise stall it.
Instead of a Terminal tab left open until dawn, Mainspring's Keep Awake power-up runs caffeinate for a duration you set and expires by itself — one of 90+ hidden macOS settings it turns into labelled, reversible toggles.
Try Mainspring free →Signed & notarized by Apple · 1-day free trial · $29 once
Wake vs. sleep, sorted out
If you're unsure whether it's the display or the whole system that's stopping your download, our explainer on display sleep versus system sleep on Mac lays out which flag targets which — and why -i is the right one for a background transfer.