Prevent accidental wakeups

Today's Best Tech Deals

Picked by Macworld's Editors

Top Deals On Great Products

Picked by Techconnect's Editors

Apple laptops have a feature that, in general, I really love: they wake up nearly instantly as soon as you unlatch the lid. There are times, however, where I’ve been burned by this feature. I tend to leave my machines set to “never sleep,” preferring to have them sleep only when I ask them to. One day, I put my 12-inch PowerBook G4 in a soft-sided case and then tossed it in the car for a three-hour drive to central Oregon.

Upon arrival, when I pulled the PowerBook from its case, I was quite surprised to find that it was very warm and had basically no battery left—sometime during the journey, or perhaps when I put the bag in the car, the lid had been bumped enough that the Mac woke up. Thankfully, no harm came to the machine, and after a recharge, it was good to go.

To prevent such things from happening in the future, though, I decided that it would be better if my Macs, as they do with sleep, would only wake on my command. There’s no built-in GUI solution to this problem, but it turns out that Apple has hidden a number of power management options in a Unix program called pmset. We covered one use of pmset, to set newer Macs’ sleep mode, in this tip. But pmset can do much more than that.

To see what options your Mac is presently configured with, launch Terminal (in /Applications -> Utilities), and type pmset -g. The output should look something like this:

	$ pmset -g

Active Profiles:
Battery Power -1
AC Power -1*
Currently in use:
womp 1
sms 1
hibernatefile /var/vm/sleepimage
acwake 0
sleep 17
autorestart 0
halfdim 1
hibernatemode 3
disksleep 10
displaysleep 3
lidwake 1

There’s a lot of information there, and I’m not going to try to explain every option in this writeup. Instead, I’ll point you to the help pages for the pmset program, which you can read by typing man pmset in Terminal. Each option is explained in the man pages, if only briefly. For instance, here’s what the help file has to say about the lidwake variable:

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

To protect my machines from accidental wakeups, that’s the variable I needed to change—its present value of 1 means “enabled.” I needed to set it to 0, for “disabled.”

To change any pmset value, you must execute the command as root. You also have to tell the system whether you want the change to affect your machine when it’s running on battery power, wall power, a UPS, or any of the above. You do this with a flag, where -a means all power sources, -b is the battery, -c is the charger (wall power), and -u is a UPS. In my case, I wanted to change the variable for all power sources, so I used -a. The full command, then, looked like this:

sudo pmset -a lidwake 0

After supplying my admin password, the change was made without any sort of acknowledgment—you’ll just get a new Terminal prompt when it’s done. I verified the change had been made by typing pmset -g again, and making sure that lidwake showed a value of 0.

To test the new setting, close the lid on your laptop, wait until it’s fully asleep (the power light will be blinking), and then open the lid. Assuming you typed everything correctly, nothing at all will happen. Now press a key on the keyboard, and your Mac should wake up.

As noted, there are a lot of interesting behaviors you can change with pmset. Before you try changing any of them, though, make sure you print out your current settings (using pmset -g ) so that you can easily revert if you need to. Also note that not all Macs support all power management features; setting lidwake on a Mac Pro, for instance, won’t do anything. To see what features your Mac supports, type pmset -g cap. The resulting list will reflect only those options that your machine supports.

Note: When you purchase something after clicking links in our articles, we may earn a small commission. Read our affiliate link policy for more details.
Shop Tech Products at Amazon