Your Mac keeps going to sleep. Here is how to stop it
Updated 21 September 2026 · KirsuLab
A Mac that falls asleep in the middle of a long job is a small disaster you only notice afterwards: the render is half done, the upload timed out, the backup never finished. The reason is simple once you know it, and there are three ways to prevent it.
Why it happens
macOS measures idleness by input, not by work. If nothing has touched the keyboard, trackpad or mouse for the number of minutes set in Energy Saver, the Mac prepares to sleep, no matter what it is doing.
Apps can ask the system to stay awake by declaring that they are busy. Time Machine does it, and so do most video editors while exporting. Plenty of others do not: a download in a browser tab, a command-line build, a long upload, a file copy over the network, a presentation left on screen.
There are two separate timers. Display sleep turns the screen off. System sleep suspends the machine itself. The screen going dark does not necessarily stop the work, but on most Macs the system timer follows soon after.
Option 1: System Settings
Open System Settings → Lock Screen and Battery or Energy, and push the sleep timers out.
It works, and it has one flaw: it is permanent. You set it for one long job, forget about it, and a month later the MacBook is spending the night awake in a bag. If you take this route, set a reminder to put it back.
Option 2: the caffeinate command
Every Mac already has it, and it needs no installation:
caffeinate -i rsync -a ~/Movies backup:/volume/
caffeinate -t 3600
The first keeps the Mac awake for exactly as long as the command runs. The second holds it awake for an hour and then lets go. The -i flag prevents idle sleep and lets the display sleep normally, -d keeps the display awake too.
The limits: there is no countdown, nothing starts it for you, and the session belongs to the terminal window. Close the window and the Mac is free to sleep again.
Option 3: a menu bar app
The point of an app is that it answers the question caffeinate ignores: for how long, and who ends it. A good one shows a countdown, extends on request, and stops by itself.
Valpas, which we make, is built around that single question. Click the icon, pick 15 minutes, an hour, four hours or forever, and the panel says in plain words what is happening and when it ends. Add 15 minutes when the job runs long. Choose whether the display stays lit or sleeps while the Mac keeps working.
It can also start on its own: while the power adapter is connected, while an external display is attached, while the microphone is in use for a call, or while a chosen app is running. A battery guard ends the session when the charge runs low, so a keep-awake app never empties the machine. When the time is up, Valpas steps aside and your own sleep settings take over again, exactly as before.
Valpas is free, sandboxed, has no network access and asks for no permissions. Amphetamine is the other well-known choice, also free, with more triggers and a closed-display mode. The full comparison, including caffeinate, is on our comparison page.
The lid-closed case
Closing the lid puts a MacBook to sleep. macOS allows an exception only when a power adapter and an external display are connected. Everything else needs a privileged helper installed outside the App Store sandbox, which is what Valpas Pro and Amphetamine's Enhancer do.
If you go that way, respect the heat. A shut MacBook cannot cool through the keyboard. Keep it on a hard, open surface, never in a bag, on a bed or under anything.
Short answer
- One command to babysit:
caffeinate -i <command>. - One job, and you want to see when it ends: a timed session in a menu bar app.
- Every day, hands off: rules that start on the adapter or with a display attached.
- Permanently awake in System Settings: only if you will remember to undo it.
Valpas is on the Valpas page: free on the Mac App Store, via Homebrew, or as a direct download.
Questions & answers
Why does my Mac sleep while a download is running?expand_more
macOS counts idle time by input, not by work. If nothing touches the keyboard, trackpad or mouse, the timer runs down even while a download, render or backup is going. Some apps hold the Mac awake by declaring what they are doing, but most do not.
Does changing Energy Saver settings hurt the battery?expand_more
Keeping a laptop awake drains it faster, and a fully prevented sleep on battery is the one case worth avoiding. Keeping the Mac awake on the power adapter is harmless. A keep-awake tool with a battery guard is safer than turning sleep off permanently.
How do I keep the Mac awake for just one job?expand_more
Run caffeinate in front of the command, or start a timed session in a menu bar app and let it end by itself. Both are better than turning sleep off in System Settings and forgetting to turn it back on.
Can a MacBook stay awake with the lid closed?expand_more
Only with the power adapter and an external display connected, unless an app installs a privileged helper to hold sleep off. Valpas Pro and Amphetamine both do that. A closed MacBook cannot cool through the keyboard, so keep it on a hard surface, never in a bag.
Why does the screen dim even when the Mac stays awake?expand_more
Display sleep and system sleep are separate timers. You can let the screen go dark while the Mac keeps working, which saves power, or hold both awake when you need to watch progress from across the room.