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
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
Battery Power -1
AC Power -1*
Currently in use:
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
program, which you can read by typing
in Terminal. Each option is explained in the
pages, if only briefly. For instance, here’s what the help file has to say about the
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
means “enabled.” I needed to set it to
0, for “disabled.”
To change any
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
means all power sources,
is the battery,
is the charger (wall power), and
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
again, and making sure that
showed a value of
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
) so that you can easily revert if you need to. Also note that not all Macs support all power management features; setting
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.