How to keep macbook running on lid down

Yesterday mac os 10.14, mojave, developer beta was released. And obviously I wanted to use it as soon as possible so I set it to download at night. However, I wasn’t comfortable in letting it run with lid open (due to personal reasons), so I decided to tweak my mac to run with lid down, without going to sleep.

Tested in: Mac OS 10.13 El Capitan & Mac OS 10.14 Mujave.

What did NOT work to keep macbook alive with lid down

First of all I will share what didn’t work or what I didn’t use:

  • I tried using amphetamine, however it didn’t work. It simply keeps your macbook running and prevents it from going to sleep, until the lid goes down. So practically useless in our scenario.
  • Caffeine: didn’t use, found an easier and better way (and so am not sure if caffeine works or not)
  • InsomniaX: looks promising from it’s description, but didn’t use, again coz I found a better way to do it!

How to keep macbook running on lid down using terminal command

The easiest way is to use two commands:

  1. first to turn off sleeping on lid down
  2. second to enable sleeping on lid down when you’re done

Terminal command to keep macbook running on lid down:

sudo pmset -b sleep 0; sudo pmset -b disablesleep 1

Terminal command to re-enable macbook pro to sleep on lid down

sudo pmset -b sleep 5; sudo pmset -b disablesleep 0

For further reading you can refer to this answer on stackoverflow.

However make sure that once your task is done, you normalize the functionality by re-enabling macbook to work normally and sleep when lid goes down. Because the command disables sleep on battery too.

Let me know if you have any query.

Leave a Reply

Your email address will not be published.