116

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.

  • 3
    In Yosemite, there is an option named *Prevent computer from sleeping automatically when the display is off" in System Preferences > Energy Saver. – Daniel Dec 9 '15 at 13:13
117
  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.

  • 21
    Note this is control-shift-power on newer macs without an eject key – dstarh Apr 18 '14 at 17:20
  • 5
    With external keyboard without the eject key, one can check the Show keychain status in menu bar option in Keychain Access App's Preferences. Then you will be able to Lock Screen in the menu bar by clicking the lock icon. – Mengdi Gao Sep 1 '14 at 14:45
  • 3
    If I change the setting to never go to sleep, will the MacBook still go to sleep if I manually tell it to? – NobleUplift Mar 20 '15 at 12:53
  • 5
    So the computer is still awake when the display is off and locked? Does it keep working when in the password prompt window? And this would apply to keeping scripts (python and php in terminal) running? – alex9311 Feb 18 '16 at 11:31
  • 1
    Yes. Locking access to your device and/or keychain does not stop other processes from running. – mikezter Feb 27 '16 at 12:44
8

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)

2

Wimoweh $$ will automatically keep your mac awake when user selectable processes are running and will control the display sleeping (or not) as well.

  • 2
    We like answers to be more than just a single line. Ideally, you want to explain why your answer is *right." It also helps to provide links, citations, and/or screen shots. Please review our help section How to Answer on writing good answers to questions – Allan Jun 27 '16 at 18:48
2

If you don't use an Apple keyboard, you can lock it with the mouse by selecting your name in the right-side of the menubar and click Login Window...

2

You can use KeepingYouAwake. It is a free and lightweight menu bar utility for macOS (Version 10.10 and newer) that can prevent your Mac from entering sleep mode for a predefined duration or as long as it is activated.

It can be easily installed using Homebrew cask by running:

brew cask install keepingyouawake

It is an alternative to widely popular tool Caffeine from Lighthead Software. Caffeine hasn't been updated in a while. KeepingYouAwake's icons are Retina-compatible and do look nice in the dark themed menu bar.

Once you have activated KeepingYouAwake, you can simply lock the screen (by pressing Control + Command + q), turn down the screen brightness and remain assured that the system won't go to sleep!

1

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

-1

You can try "Lock Me Now" app from the app store. It gives a pretty neat way to lock the mac.

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .