Whenever I lock my screen (via either the lock icon -> Lock screen or by using the Control+shift+eject key combination), my screen immediately turns off (not showing the screen saver), and the system seems to sleep. This is inconvenient because it disconnects me from the network, causing Jabber to go offline / ssh connections to die.

I am constantly connected to AC, and am using the following Energy Saver->Power Adapter options:

  • Turn display off after: Never
  • Prevent computer from sleeping automatically when the display is off
  • Wake for Wi-Fi access

I have a 'late 2013' MacBook Pro running OS X 10.9.1.

Is there any way to stop this from happening?

Had the same problem in my Macbook(15") pro running 10.9.4.

I wanted my Mac to be locked while I was away (so configured hot corners) but at the same time did not want it to sleep (irrespective of whether it is connected to power or not) so that my wifi will be "ON" always for my jabber & mails. So here's what I did to prevent Mac from sleeping:

  1. Open Terminal
  2. Run sudo pmset -a sleep 0

Explanation of the command:

  • pmset command is to manipulate power management settings.

  • -a specifies that the setting applies for all conditions (power & battery)

  • sleep configure system sleep timer

  • 0 to disable

Check out man pmset for more information.

  • How to turn it back on? – Daniel Cukier Apr 8 at 23:02
  • sudo pmset -a sleep 30 # will configure machine to sleep after 30 minutes – Chris Betti May 8 at 14:59
up vote 8 down vote accepted

I found a solution that works for my needs: As it turns out, I should not lock the screen, but instead start the screensaver, and require the screensaver to immediately require a password.

I created a 'Start Screensaver' service with Automator, and then selected a keyboard shortcut for that service under Settings->Keyboard->Shortcuts->Services.

Use either caffeinate or something like wimoweh

  • 1
    So I need a third party app that prevents the mac from sleeping? I can't just disable 'sleep on lock' somehow? – Martin Feb 11 '14 at 14:45
  • 1
    caffeinate is part of the system but it's a command line tool. I don't think there's a preference that will disable sleep completely. I will personally leave my macbook go to sleep and use mosh to circumvent the ssh disconnection problem. – huy Feb 11 '14 at 15:36

The answer is in your post. Just uncheck "Wake for Wifi Access" in the System Preferences under Energy Saver, Power Adapter.

When it's checked, it means that your computer disconnects from the network when you're computer's not awake.

You can use InsomniaX for that.

With that, you can prevent your mac from sleeping, wether it's idle sleep or even when you close the lid.

  • 1
    Please summarize as the link might die in the future. – Rob Feb 11 '14 at 14:31
  • +1 the only one with decent settings for everything and it works on El Capitan. – unom Mar 9 '16 at 9:16

I have a Mac Book Pro running 10.9.5. To keep it from sleeping when I locked the screen, I changed the Energy Saver settings for Power Adapter, I checked "Prevent computer from sleeping automatically when the display is off" and I unchecked "Wake for network access".

I went to System Preferences > Energy Saver and unchecked Enabled Power Nap while plugged into a power adapter.

Install SmartSleep(from Apple Store) with Insomnia plugin and your problem should be solved. You can even play music with your lid closed with no problems.

Your Answer

 

By clicking "Post Your Answer", you acknowledge that you have read our updated terms of service, privacy policy and cookie policy, and that your continued use of the website is subject to these policies.

Not the answer you're looking for? Browse other questions tagged or ask your own question.