On this page
You kick off the full test suite and go make coffee. When you come back, the screen is black. The computer went to sleep twenty minutes in, and the run died with it.
It is the same story with a Docker image build, a database migration, a large download or an AI agent halfway through a refactor. This guide covers how to keep your computer awake for long jobs, and the limits you should know.
In short
- Sleep pauses processes and can drop network connections, so long jobs fail.
- On macOS,
caffeinateworks if you remember to type it first. - Keep Awake in DevWorkspace Pro gives you a one-click timer on macOS, Windows and Linux.
- It does not work with the laptop lid closed, and it stops when you quit the app.
Why sleep breaks long jobs
When a computer sleeps, running processes pause and network connections can time out. Some jobs recover. Many do not:
- A package install or
git clonefails with a network error. - A test run against a remote service times out.
- A remote SSH session drops.
- A local AI coding agent stops in the middle of a task, because it runs on your computer.
That last one is new. Cloud agents keep going while your laptop is closed. Local agents, such as Claude Code or Codex CLI in a terminal, stop when the computer sleeps. See Local vs cloud AI coding agents.
Option 1: the macOS caffeinate command
macOS ships with a command-line tool for this:
caffeinate -i npm run build
A few useful flags:
caffeinate -iprevents idle sleep while the command runs.caffeinate -dalso keeps the display on.caffeinate -t 3600keeps the computer awake for one hour.
It works well when you remember to type it before the command. It does not help when the job is already running, or when you want a timer without a command.
Option 2: Keep Awake in DevWorkspace Pro
Keep Awake is a utility in DevWorkspace Pro. On macOS it runs the built-in caffeinate tool. It also works on Windows and Linux.
Turn it on
- Click the cup icon in the header. The header shows on all pages.
- Select a duration: 15m, 30m, 1h, 2h, 4h or Until off.
Keep Awake starts at once. The cup turns green and shows a small dot. Hover over it to see the time left.
The menu works too, even when the main window is closed:
| Platform | Menu |
|---|---|
| macOS | DevWorkspace Pro → Keep Mac Awake |
| Windows and Linux | Tools → Keep Computer Awake |
Let the display sleep (or not)
| Keep display on | Result |
|---|---|
| On (default) | The computer and the display stay on |
| Off | The computer stays on. The display can sleep. |
For overnight jobs, turn the display setting off. The job keeps running and the screen goes dark. The app remembers your choice.
Turn it off
- Click the cup icon, then Let it sleep.
- Or, on macOS, use Keep Mac Awake → Let It Sleep in the menu.
Keep Awake also stops when the duration ends and when you quit DevWorkspace Pro. On macOS, caffeinate stops too if the app stops unexpectedly. A crash will not keep your computer awake forever.
Why not change the system sleep settings?
You can raise the sleep timer in System Settings on macOS, or in the power settings on Windows and Linux. It works, but it has costs:
- The change applies all the time, not only during the job. You must remember to change it back.
- On battery, a long sleep timer drains the battery on days with no long jobs.
- Nothing tells you that the computer is being kept awake.
A timed keep-awake applies only for the job. When the time ends, your normal sleep settings apply again. The green cup in the header shows that it is on, and a hover shows the time left.
How long to pick
| Job | Suggested duration |
|---|---|
| Test suite, image build | 30m or 1h |
| Database migration on a large table | 1h or 2h |
| Large download or model download | 1h to 4h |
| AI agent working on a multi-step task | 1h or 2h |
| Overnight job | Until off, with display off |
When in doubt, choose a fixed duration over Until off. If you forget about it, the computer can sleep again when the time ends.
Limits to keep in mind
- Closing the lid. Keep Awake does not stop sleep when you close the lid of a laptop. Leave the lid open during the job.
- Battery. A computer that stays awake on battery uses more power. Plug in for long jobs.
- The app must stay open. Keep Awake stops when you quit DevWorkspace Pro.
Voice-to-Text keeps it awake too
Voice-to-Text in DevWorkspace Pro also keeps the computer awake during a recording, so a long dictation does not stop halfway. See Voice-to-Text.
Pair it with session resume
Keep Awake prevents most interruptions, but not all of them. A restart for an update is one it cannot stop. For those, DevWorkspace Pro keeps a record of unfinished AI sessions and restores the text of each Terminal tab. See Resume Claude Code sessions after a restart.
FAQ
Frequently asked questions
Does Keep Awake work on Windows and Linux?
Yes. On macOS it runs the built-in caffeinate tool. On Windows and Linux, use the cup icon or Tools → Keep Computer Awake.
Does Keep Awake work when I close my laptop lid?
No. Keep Awake does not stop sleep when you close the lid of a laptop.
Can the display sleep while the computer stays on?
Yes. Turn off Keep display on. The computer stays on and the display can sleep.
What happens if DevWorkspace Pro quits?
Keep Awake stops when you quit the app. On macOS, caffeinate also stops if the app stops unexpectedly, so your Mac does not stay awake forever.
How is this different from running caffeinate in a terminal?
It is the same tool on macOS, with a timer, a status icon, a menu item that works with the main window closed, and an automatic stop when the app quits.