Dimma Screen

Guide · macOS

How to keep your Mac awake while it's locked

Locking a Mac with ⌃⌘Q doesn't stop your apps. Sleep does. To keep a locked Mac working, run caffeinate -i in Terminal, leave the window open, then press ⌃⌘Q. For a setting that lasts, turn on "Prevent automatic sleeping on power adapter when the display is off" on a MacBook, or "Prevent automatic sleeping when the display is off" on a desktop Mac.

Display sleep isn't system sleep

A Mac can be locked, have its display off, or be asleep. Only system sleep stops your work.

StateScreenApps, downloads, agents
LockedLogin windowKeep running
Display sleepDarkKeep running
System sleepDarkStop until the Mac wakes

After you lock, the display turns off about 30 seconds later. That's display sleep, and it doesn't stop your apps. System sleep comes later, based on your energy settings. Keeping a locked Mac working just means preventing that second step.

Sources: Apple's guide to sleep and wake settings and our tests of each lock method.

Use caffeinate for one job

  1. Run this in Terminal to keep the Mac awake for two hours. Keep the window open.
    caffeinate -i -t 7200
  2. Press ⌃⌘Q.
  3. When you're back, press ⌃C in Terminal to stop early.

From man caffeinate:

  • -i prevents idle sleep. This is the flag that matters for a locked Mac.
  • -s keeps the Mac from sleeping at all, but only while on power adapter.
  • -d keeps the display on too. You don't need it for downloads or terminal agents.
  • -t 7200 stops after 7,200 seconds (2 hours). Omit it to run until you press ⌃C.

You may also see caffeinate -dimsu recommended online. It adds -m (disk stays awake) and -u (declares the user active to turn the display on, which lasts 5 seconds unless you set -t). For a locked Mac, -i is all you need.

To run a specific command and exit when it finishes, put it after caffeinate -i, such as caffeinate -i ./long-build.sh. To check what's keeping your Mac awake at any time, run pmset -g assertions.

Or change one setting

  • MacBook: System Settings › Battery › Options › "Prevent automatic sleeping on power adapter when the display is off." It only works while plugged in. On battery, use caffeinate -i.
  • Desktop Mac: System Settings › Energy › "Prevent automatic sleeping when the display is off."

The display still turns off after you lock, but the Mac keeps running behind it. Read more in how to keep your Mac awake.

If you'd rather not leave the login window up

The macOS lock screen shows the login window before turning dark. You can't glance at a download or an agent from across the room, and any agent taking screenshots gets black images on the lock screen (our tests).

Dimma Screen is a menu bar app that covers every display instead. Choose Turn On and Keep Awake for 30 minutes, 1 hour, 2 hours, or 4 hours. The display stays lit and the Mac stays awake. Any key press or click asks for your 4- to 8-digit PIN, your login password, or Touch ID.

  • By default the cover is a 6% tint. Your screen stays visible, but input is blocked until you enter your PIN, password, or Touch ID. To hide it, choose Solid Color or Custom Image in Settings.
  • When the time is up, the overlay stays and your Mac follows its usual energy settings.
  • Lock Screen When Keep Awake Ends (Settings › General › Overlay, off by default) sends the Mac to the macOS lock screen when the time is up, just like pressing ⌃⌘Q.

Dimma Screen · macOS 26 Tahoe or later · Apple silicon · All features free for 3 days, then $9.90 once. No subscription.

Limits

  • Not a security lock. It's a privacy overlay. Where you need real security, press ⌃⌘Q.
  • Keep Awake stops at 4 hours. For longer jobs, use caffeinate -i or caffeinate -s.
  • Closing the lid still puts the Mac to sleep. Keep the lid open.
  • It doesn't move the pointer or press keys. macOS keeps counting idle time.

Questions

Does locking my Mac stop downloads or AI agents?

No. Downloads, builds, and terminal agents keep running while the Mac is locked, as long as it stays awake. Sleep is what stops them. Agents that need the screen are different: on the lock screen, screenshots come back black and web pages stop rendering.

What's the difference between display sleep and system sleep?

Display sleep only turns the screen off. Apps keep running. System sleep pauses the Mac itself, so apps pause until it wakes. A locked Mac turns its display off after about 30 seconds, then goes to system sleep on its usual schedule unless something keeps it awake.

What happens when I close the lid?

Closing the lid puts a MacBook to sleep, and your apps stop. The exception is closed-lid mode: the Mac is on power with an external display, keyboard, and mouse connected. Dimma Screen doesn't keep a closed-lid Mac awake. Keep the lid open.

How long can Dimma Screen keep my Mac awake?

Up to 4 hours. Turn On and Keep Awake offers 30 minutes, 1 hour, 2 hours, or 4 hours. When the time is up, the overlay stays and the Mac follows its usual energy settings. For longer jobs, use caffeinate -i.