18

In Windows one can usually choose between

  • Do nothing,
  • Sleep,
  • Hibernate.

The Macbook, however, doesn't seem to have this setting. It'll always go to sleep. I would like to set it to "Do nothing" to be able to finish downloads.

13

Nope, there's no such setting in OS X. This has lead to the creation of a number of sleep-prevention apps:

1
  • InsomniaX is now abandonware Apr 13 '21 at 13:47
5

You can use the command line utility pmset to change the behavior of the lid closed/open state.

To disable wake/sleep on lid state:

sudo pmset -a lidwake 0

To undo the last setting

sudo pmset -a lidwake 1

By default, closing the lid will put the Mac to sleep. Setting the lidwake 0 value will disable it meaning closing the lid will do nothing.

4
  • 2
    Did not work for me. Am I missing anything? macOS Sierra 10.12.16
    – mathakoot
    Oct 7 '17 at 18:07
  • A pivot workaround is System Preferences -> Desktop and Screensaver -> Hot Corners -> Set lower right hotcorner to perform an action like put display to sleep or enable screen saver. So before you close the lid just send the cursor to the lower right and then close the lid, your behavior is carried out before the lid close. May 14 '19 at 0:21
  • 1
    pmset -g live shows lidwake 1 but still the laptop gets hot and occasionally whirrs when the lid is closed. Do I have the wrong expectations for what this does, or is something else wrong (like it tries to suspend as per this setting, but somehow can't? How can I troubleshoot that)?
    – tripleee
    Jun 25 '19 at 8:51
  • pmset lidwake doesn't change the sleep state. It just means if lid is open it will wake the mac or not. according to pmset man [lidwake - wake the machine when the laptop lid (or clamshell) is opened (value = 0/1)]. so if lidwake=1 it will wake the machine automatically otherwise not.
    – atiq1589
    Oct 31 '21 at 2:23
3

Steps:

  1. Connect keyboard and mouse to your macbook
  2. Connect the external display and let it be identified
  3. Connect charger
  4. Just close the lid

Works on my early 2015 macbook pro A1502 It is recommended to put your macbook to sleep before unplugging the external display.

More here > https://support.apple.com/en-in/HT201834

NOTE: I am on High Sierra, missed reading OSX while pushing the answer, but the link suggest same may work on all. Do try and leave a comment if it works!

3
  • 1
    what if I don't have keyboard nor mouse? ;)
    – Line
    Apr 6 '19 at 18:28
  • The link is to a page which explains how to not suspend when you close the lid. This is called "closed-display mode".
    – tripleee
    Jun 25 '19 at 8:43
  • Apparently my mbp been in closed-display mode ever since I posted this answer :\
    – absin
    Jun 27 '19 at 2:50
1

One possible solution would be to use this pmset setting:

ttyskeepawake - prevent idle system sleep when any tty (e.g. remote login session) is 'active'. A tty is 'inactive' only when its idle time exceeds the system sleep timer. (value = 0/1)

Regarding another solution:

    sudo pmset -a lidwake 0

According to the man page, the lidwake only takes a laptop out of standby.

lidwake - wake the machine when the laptop lid (or clamshell) is opened (value = 0/1)

If doesn't say anything about staying awake when the lid closes

If the lidwake setting actually does work for you, you will likely NOT want to use the -a flag because sometime when you are out and about, you will kill your battery becuase your laptop will not go into standby.

Use the -c (charger) flag instead.

sudo pmset -c lidwake 0

Finally, type the word caffeinate on the command line and that will prevent the laptop from going into standby for as long as the terminal is open or the command is running.

You must log in to answer this question.

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