Mouse JigglerMade for MacApp Store
macOS guides

Keep Your Mac Awake While Locked: A Caffeinate Setup

Run a timed awake request behind a locked Mac screen. Check the request and the task’s progress while keeping normal password protection.

An open silver laptop with a blue lock symbol beside a translucent progress indicator, illustrating background work behind a locked screen.
Editorial illustration
The quick answer

Run caffeinate -i -t 1800 for a 30-minute awake request, then choose Apple menu → Lock Screen. Leave Terminal running and the MacBook lid open. Unlock normally when you return and check the task’s result.

Set up a 30-minute locked session

  1. Connect your MacBook to power if practical and leave its lid open. Start the download, export, or other task you want to finish.
  2. Open Terminal with Spotlight and enter:
caffeinate -i -t 1800
  1. Leave that Terminal window open. A quiet window with no progress message is normal.
  2. Choose Apple menu → Lock Screen, or press Control-Command-Q. Use Lock Screen rather than Sleep or Log Out.
  3. When you return, unlock your Mac and check the task itself. To end the awake request early, return to its Terminal window and press Control-C.

The timer starts when you run the command, not when you lock the screen. 1800 means 30 minutes; use 3600 for an hour. The -i flag requests protection from idle system sleep without requesting an illuminated display. It does not change your password requirement. Apple documents Control-Command-Q as the screen-lock shortcut.

Check the request before locking

Keep the first Terminal window running. Open a second tab or window and run:

pmset -g assertions

Find a process named caffeinate with an assertion type of PreventUserIdleSystemSleep. Other applications may also appear. You are checking the request belonging to your command, rather than assuming that a system-wide total came from it.

After the timer expires or you stop that command, run the check again. Its assertion should disappear. Another app may still prevent sleep; stopping your command does not stop other apps. The guide to finding what keeps a Mac awake explains how to investigate those separately.

Can the display turn off while the Mac is locked?

Yes. This setup lets the display go dark while the desktop is locked and a background task runs. Check the task after unlocking; screen darkness alone tells you little. The sleep and screen-lock guide explains the three states.

For a recurring session on power, Apple lists a sleep-prevention option under System Settings → Battery → Options on Mac laptops. Enable Prevent automatic sleeping on power adapter when the display is off. Desktop Macs have the corresponding control under System Settings → Energy. Availability varies by model. Note your original setting and restore it when the arrangement is no longer needed.

Apple’s sleep settings guide covers these controls. Use either a temporary command or the appropriate preference first, so you can tell which change affects your result. Keeping a Mac awake still consumes power even with a dark display.

Example: leave a download running while you step away

For a download with about 12 minutes remaining and a 20-minute break, a 30-minute timer leaves some margin. It still ends at its set time, even if the download takes longer.

Before locking, note the downloaded amount and time. Leave the browser and Terminal running, lock the screen, and return before the timer ends for the first trial. Look for the browser’s completed-download state and the resulting file. If the download is still running, compare its progress with your note before deciding whether sleep was involved.

If the timer ends first, normal idle-sleep rules can resume. If the connection fails, keeping the Mac awake cannot repair it. Our download settings and recovery guide covers interrupted transfers. This is a suggested comparison procedure, not a claim that every download service continues under every lock or power policy.

What we checked for this guide

On September 28, 2026, we checked the installed caffeinate manual and ran two short command tests on macOS 27.0:

  • caffeinate -i -t 3 created its own idle-system-sleep assertion, exited normally after about three seconds, and released that assertion.
  • A second timed invocation released its assertion when interrupted with SIGINT, the signal normally sent by Control-C in Terminal.

We checked only the assertion created by each test process. These tests verify the timer and stopping mechanism; they do not verify a locked-screen download, closed-lid operation, or behavior on every Mac. Use the short trial above with your actual app before relying on a longer session. For all flags and command-scoped sessions, use our full caffeinate guide or run man caffeinate on your own Mac.

How Mouse Jiggler’s screen-lock setting fits

Mouse Jiggler 3.4 in light mode: Pause When Screen Is Locked is on; Prevent Sleep While Active and Launch at Login are off; the battery cutoff is 5%.
Mouse Jiggler 3.4 settings supplied for the site. Pause When Screen Is Locked is on; Prevent Sleep While Active is off. Screenshot retouched for presentation. View full size ↗

In Mouse Jiggler 3.4, Pause When Screen Is Locked and Prevent Sleep While Active are separate controls. The capture shows pausing on and sleep prevention off. Check your installed settings and the task’s progress; the screenshot shows the controls, not a test of how they interact during a transfer.

For a job that only needs the system awake behind a locked screen, start with the timed sleep request above. You do not need to remove your lock requirement or add automatic clicks to that workflow. If you want visible cursor movement while working, use the mouse mover controls guide to configure that separate session.

For a separate menu-bar movement routine, download Mouse Jiggler on the Mac App Store and review its screen-lock pause and sleep-prevention settings. The timed command above remains the starting point for the locked background task described here.

If work still stops after you lock the screen

What you observeCheck next
The screen is black, but the task finishedThe dark display was not a failure. Keep your normal lock protection.
Your caffeinate assertion has disappearedCheck whether the timer expired or the command was stopped. Run a fresh short test.
The assertion remains, but the task reports an errorRecord the app’s error and check its connection, destination and sign-in state.
The interruption follows closing the lidRepeat with the lid open. A request against idle sleep is not a general closed-lid override.
A setting is unavailable or controlled by your organizationCheck with the administrator instead of changing managed security requirements.

Record the power source, command start time, lock time, progress, and error. Compare one setting per trial so a timer ending is not confused with a network failure. Stop the temporary request and restore any changed preference when done.

Match the timer to your background task.

Keep your normal screen-lock requirement and check the active sleep request. Use the command guide for other durations and stopping options.

Review timers and stop commands

View Mouse Jiggler on the Mac App Store · Free to download, with optional PRO features.