Lock screen
How to lock a Mac without putting it to sleep
Locking a Mac does not put it to sleep: Control-Command-Q or Apple menu > Lock Screen locks the screen and leaves your apps running. The Mac can still idle-sleep later, after the display turns off, unless a prevent-sleep setting is on or a tool such as caffeinate -i holds it awake.
On this page
- Does locking a Mac put it to sleep?
- How do you lock the screen?
- How do you turn the display off without sleeping?
- Which setting keeps the Mac awake once the display is off?
- Does a locked Mac keep downloads, builds and agents running?
- Why does Teams show Away when the Mac locks?
- How do you check the Mac stayed awake while locked?

Does locking a Mac put it to sleep?
No. Locking a Mac hides your session behind the login password, but it stays awake with your apps still running. Apple lists Lock Screen and Sleep as separate commands in the Apple menu, in its pages on locking the screen and putting a Mac to sleep.
Easiest way: Napless. Start a hold for a duration, until a clock time, or until you stop it, and leave Allow Display to Sleep on so the screen can turn off after you lock. Try Napless free for 7 days.
The Mac can still sleep later. Apple says “The Lock Screen shows your Screen Saver after a period of inactivity”. Next, the display turns off after the time set in Lock Screen settings. After that, the Mac follows its normal idle-sleep rules.
The display matters for a reason you can see in Terminal. On a MacBook Pro running macOS 27.2, pmset -g assertions listed powerd holding PreventUserIdleSystemSleep named “Powerd - Prevent sleep while display is on”. When the display turns off, that hold ends, and the Mac can sleep unless a setting or another process keeps it up.
So the order on a locked, idle Mac is:
- Lock.
- Screen saver.
- Display off.
- Possible system sleep.
The settings and tools below stop step 4.
How do you lock the screen?
Press Control-Command-Q, or choose Apple menu > Lock Screen. Both lock the screen at once, according to Apple’s keyboard shortcuts page and lock screen guide.
Other ways Apple documents:
- Touch ID. On keyboards with Touch ID, press it to lock the screen.
- Lock Screen key. Press it if your Magic Keyboard has one.
- Hot corner. Open System Settings > Desktop & Dock > Hot Corners, and choose Lock Screen for a corner (hot corners guide).
- Automatic lock. In System Settings > Lock Screen, set “Require password after screen saver begins or display is turned off” (Lock Screen settings).
To come back, press any key and enter your password, or use Touch ID or an Apple Watch, as the lock screen guide describes.
How do you turn the display off without sleeping?
On a built-in keyboard without Touch ID, press Control-Shift-Power to put the displays to sleep. Apple’s shortcuts page lists it that way, and the system keeps running.
From Terminal, man pmset lists displaysleepnow, which “causes display to go to sleep immediately”:
pmset displaysleepnow
Display sleep and system sleep are separate in macOS. man pmset has one timer for each: displaysleep for the screen and sleep for the whole Mac. Turning the display off still ends the “Prevent sleep while display is on” hold, so the next section still applies.
If “Require password after screen saver begins or display is turned off” is set in Lock Screen settings, turning off the display also locks the Mac after the delay you chose there.
Which setting keeps the Mac awake once the display is off?
On a laptop plugged into power, turn on Battery > Options > “Prevent automatic sleeping on power adapter when the display is off”. On a desktop, turn on Energy > “Prevent automatic sleeping when the display is off”. Both are documented on Apple’s sleep and wake settings page.
| Mac | Setting | Covers |
|---|---|---|
| Laptop | System Settings > Battery > Options > “Prevent automatic sleeping on power adapter when the display is off” | On power adapter only |
| Desktop | System Settings > Energy > “Prevent automatic sleeping when the display is off” | Always |
| Any Mac | caffeinate -i in Terminal |
Until you stop it, or for the length of a command |
On battery, System Settings has no such checkbox. Use a hold instead. man caffeinate says -i creates “an assertion to prevent the system from idle sleeping”. The hold lasts until caffeinate exits, or for as long as the command you give it runs:
caffeinate -i
caffeinate -i -t 3600
caffeinate -i -w 12345
The second line holds for one hour (-t is in seconds). The third holds until process 12345 exits. The caffeinate command guide covers the rest of the flags.
None of these keeps a laptop awake when you close the lid. Apple lists closing the display as a way to put a Mac laptop to sleep. You can lock and walk away with the lid open. Closing the lid is a separate case, covered in keeping a MacBook awake with the lid closed.
Apple also warns that preventing sleep “may increase power consumption”.
Napless can hold the Mac awake from the menu bar instead. With Allow display to sleep on (the default), Napless “keeps the Mac from idle sleep and the display can sleep”, per Napless Help. Start Keep Awake For or Keep Awake Until, then lock the screen. A new install is a 7-day free trial, then Napless Pro.
Does a locked Mac keep downloads, builds and agents running?
Yes, as long as the Mac stays awake. Locking keeps you logged in, so the download, build or agent session is still running when you come back. Sleep stops them; the lock doesn’t.
Match the hold to the job:
- A download. Hold sleep until it finishes, then let the Mac sleep. The guide to keep a download running covers browser, App Store and Terminal downloads.
- A build or script. Run it under caffeinate, for example
caffeinate -i make.man caffeinatesays the hold persists “for the duration of the utility’s execution”. - Claude Code. Claude Code CLI 2.1.287 on macOS runs
caffeinate -i -t 300itself while it works, restarts it every 240 s, and releases 30 s after it goes idle. A locked Mac stays up while Claude Code works. Once it goes idle, the Mac can sleep. - Codex. Codex CLI 0.159 has an experimental, off-by-default “Prevent sleep while running” option in
/experimental.
Details for each agent are in keeping a Mac awake for AI coding agents. For a broader comparison, see how to keep a Mac awake.
Why does Teams show Away when the Mac locks?
Microsoft Teams sets you to Away when the computer is locked, even if the Mac never sleeps. Microsoft Learn’s presence page lists a locked computer as an Away trigger, alongside a few minutes of inactivity. It also says presence goes Offline when the computer enters sleep mode.
A Mac that stays awake keeps you from showing Offline in Teams, but you’ll still show Away while it’s locked. Slack works on a different clock: its Help Center sets you away after 10 minutes of desktop inactivity.
The rules for both apps, and what changes them, are in why Teams shows Away when the Mac locks.
Napless Pro has a Keep chat apps active option that nudges the pointer while you are idle. Napless Help says it skips the move when the screen is locked, so it does not change the Teams lock rule either.
How do you check the Mac stayed awake while locked?
When you come back, read the power log: any “Entering Sleep state” line between the time you locked and the time you returned means the Mac slept. The log is read-only and needs no sudo.
pmset -g log | grep -E "Entering Sleep state|Wake from"
Each sleep line gives a reason in quotes, for example Entering Sleep state due to 'Clamshell Sleep' after a lid close, and each wake line starts with Wake from. No lines in your time window means the Mac stayed up.
Check before you lock, too. pmset -g assertions lists every process holding the Mac awake under “Listed by owning process”. If your caffeinate, app or agent isn’t listed there, it isn’t holding the Mac awake. The guide to reading pmset -g assertions explains each line.
Napless reports this without Terminal. Its menu shows an orange triangle after a sleep that happened while Napless was keeping the Mac awake, and Check Health… lists what went wrong, as Napless Help describes. To hold the Mac awake while the screen is locked, Try Napless free for 7 days.
Questions
What is the keyboard shortcut to lock a Mac?
Control-Command-Q locks the screen, according to Apple's Mac keyboard shortcuts page. On keyboards with Touch ID, pressing Touch ID also locks the screen.
Does a locked Mac keep downloading?
Yes, while it stays awake. Locking leaves apps running, but if the Mac idle-sleeps after the display turns off, the download stops making progress until it wakes.
How do you turn off a Mac display without sleeping the Mac?
On built-in keyboards without Touch ID, press Control-Shift-Power to put the displays to sleep. From Terminal, pmset displaysleepnow does the same. The system keeps running.
Does caffeinate work while the screen is locked?
man caffeinate says its assertion lasts until caffeinate exits, or for as long as the command it runs. The man page lists no exception for a locked screen.


