Subscribe to MacYourself via RSSFollow MacYourself on Twitter

Prevent accidental wake-ups when an Apple laptop’s lid is opened

Prevent accidental wake-ups when an Apple laptop\'s lid is opened

A Mac’s ability to start up nearly instantly after being woken from sleep is one of its strong points, but it can cause major problems if the laptop’s lid opens accidentally.

A while back my precious Macbook Pro was the victim of a couple unfortunate “incidents” shall we say, which led to one of the two hooks on the top lid being broken off. Aside from being devastated that it was no longer in pristine condition, I found myself dealing with an inconvenient problem. Any time I would put my Macbook Pro in a bag to travel with, I would later find the lid ajar and screen already turned on. This could be potentially damaging to any kind of notebook computer because the heat generated while it’s in a closed environment like a case might fry the machine’s internal components. Ouch.

I’m not sure about the Macbook and Macbook Air since they use Apple’s new magnetic latch, but I know of a surprising number of people who own a Macbook Pro or older Mac laptop and have similar broken latch troubles. Completely shutting down every time we want to take it somewhere is an option, although not particularly user-friendly. So what are we to do? A useful little Unix program that’s built into Mac OS X called pmset can help us out.

Using Terminal (located in Applications > Utilities), we can make our desired change with a single command.

sudo pmset -a lidwake 0

Once this is copied and pasted into Terminal, press enter/return on your keyboard. Next, Terminal will ask you for your administrator password. Don’t be alarmed when you start typing it and the text cursor doesn’t move. Terminal is registering your keystrokes even though they’re not being shown. Press enter/return again and you’ll be good to go. It won’t show a confirmation or any sign that the setting was changed, but rest assured that it was. To wake your Mac from sleep now, press any key on the keyboard and it will turn on like normal. If your laptop’s lid is open and flopping around in a bag, OS X won’t care — nothing will happen until you make a keystroke.

Now, depending on the kind of person you are and how much you like to really understand what’s going on behind the scenes, there is an explanation for what the pieces of this command mean. Let’s go through them one-by-one:

sudo
Tells Terminal to execute the command through the root user. The root user is the system administrator account.

pmset
As I briefly mentioned before, pmset is a Unix application that handles power management settings in OS X.

-a
Specifies that you want your laptop to make the requested change across all power sources. The other options you could use here are -b for battery only, -c for AC power charger only, and -u for UPS only (uninterruptible power supply, or battery backup).

lidwake 0
The setting which enables automatic wake-ups after the laptop’s lid is opened. Zero (0) turns this functionality off, while a one (1) would turn it back on. So if you decide to go back to allowing your Mac notebook to return from sleep when the lid is opened, use the same Terminal command and substitute the 0 with a 1.

2 Comments Have Been Posted (Leave Your Response)

thanks for this post. same problem here. been living with it for too long.

Its Way worse than you initially describe: hear that ‘buzz’ when your MacBook wakes up? That’s your hard drive spooling up. Moving a logged-in laptop in any way but gingerly is very risky. Even though MB/MBP’s have an accelerometer built in (designed to quickly withdraw the reader arms from the spinning disk if the laptop thinks it has been dropped), it may not withdraw the reader arms if you’re merely lugging it around, or especially if its being moved/tilted/rotated/bumped/…, while vertical, like in your bag. If this happens, the reader arms may gouge the disk, which is spinning at typically 5-7.2 kRPM, destroying both. A more obvious question: Why is it powered up at all when ‘traveling’? Unless by ‘traveling’, you mean driving to work/walking to class/another room/etc.