This is quite a little interest on mine. Since I have a laptop I open and close the lid a lot when moving from one place to another. As a result some time I want to change what happens. For example keeping the Mac asleep when the lid is opened and keeping my Mac awake when the lid is closed. There isn’t any default methods of doing this within the system preferences. It needs a bit of hacking and using applications to work around this problem.
The first part of this post will be to turn off the wake on lid option. This means that when the laptop is woken by opening the lid, this command should stop that. Its very simple to complete. The first step is to open Terminal. From there type:
sudo pmset -a lidwake 0
You will have to enter you admin password. This will then change a system setting located in you power management preference. If you want to change it back you have to use the same command but change the 0 to a 1.
sudo pmset -a lidwake 1
Within the code about, pmset is sort for power management settings. Most of the settings within that command relate to the settings you can access within System Preferences. the -a means that the command will work with all power sources. You can use other letters to relate the command to other sources including battery and UPS if avalible. The final piece of code, lidwake, it what we want. We are changing the binary value for this command.
As mention in the summary of this post there is way of making sure that you computer keeps running when the lid is closed. This is done through and application called InsomniaX, which has one of the best looking icons I have ever seen. This application, run from the menu bar, is designed to give your computer insomnia and stop it going to sleep when the lid is closed.
It works really well. Although I wouldn’t recommend using this option if you are using CPU intensive work. Since when the lid is closed the air ports at the back, by the screen, are blocked. As a result I can heat up the internals of your computer and possibly damage them. It has also been reported in many places that this can damage your screen due to the intense heat. Use caution.