How can I keep my Mac awake AND locked?

I want to leave my Mac awake overnight so it syncs 4GB of data from Dropbox. I need to prevent the machine from going to sleep because that pauses the Dropbox sync

I've been using Caffeine to keep the computer awake, but it also keeps the computer unlocked which is insecure.

I need a method to keep my Mac awake (so that Dropbox can sync overnight) but also locked (so no one can read my email). It'd be great if this method also turned off the screen (to preserve power), but honestly that's not even 100% necessary.


Solution 1:

  1. In System Preferences > Energy Saver, check the box for "Prevent computer from sleeping automatically when the display is off" (on laptops, this is under the Power Adapter tab)
  2. In System Preferences > Security & Privacy, check the box for "Require password after sleep or screen saver begins" and set the delay in the dropdown menu to "immediately"

Now, you can hit command-option-power to turn off the display without sleeping the computer, and doing anything that turns on the display (like hitting a key or clicking a mouse button) will prompt you for your account password.

On newer macs without the eject key, please use control-shift+power instead.

Solution 2:

Not sure when it was first available, but on MacOS High Sierra 10.13.4 you can go to Apple (top left) > Lock Screen or press control-command-q to activate the lock screen.

You should also do the first step in @daGUY's answer

In System Preferences > Energy Saver, check the box for "Prevent computer from sleeping automatically when the display is off" (on laptops, this is under the Power Adapter tab)

Solution 3:

On MacOs Mojave the accepted answer didnt work for me. What worked is to use free app Amphetamine. After app installation select the option Indefinitely. Now you can lock the screen and it will not go to sleep.

enter image description here