Filed under: Tips and tricks, iBook, PowerBook, Terminal Tips, Macbook Pro, MacBook
Terminal Tip: Keep your Mac portable from waking when the lid is opened
Although I'm a Mac Geek by trade, I tend to avoid the terminal unless I'm out of other options. I'm a GUI kind of girl. It's the Mac OS that I love, not its Unix underpinnings. I appreciate the power of the command line - I just don't want to spend all day there. Still, once in a while I come across a tip like the one, which Glenn Fleishman posted in the most recent TidBITS, and I find myself unable to resist the urge to fire up the Terminal. This tip solves a problem that I've experienced myself and many of my clients have complained about - laptops waking from sleep while in their cases because the latch won't keep the lid closed. This can cause overheating, which can lead to a variety of other problems, like hard drive failures, etc. My solution is, of course, to fix the latch! But there are times when that isn't convenient and even if it's convenient it doesn't happen often enough for some people to even bother stressing about it. By harnessing the power of pmset, the command line app that controls power management settings, you can fix it so that your sleeping beauty stays asleep, even when the latch isn't doing its job.
The command is an easy one - a single line. Ready for it?
sudo pmset lidwake 0
By setting the lidwake value to 0 you prevent the machine from waking until you tap a key on your keyboard, and since the value gets written just to a plist file, it takes hold right away. Of course you'll need administrator privileges since you'll be asked for an admin password before the command is executed.

For more pmset options, have a look at the "man" pages at Apple's Darwin Reference library, or open your Terminal and type "man" (without the quotes), hit return and then type "pmset" (without the quotes.)
Get a WordPress.com Blog
![TUAW [Cafepress]](http://www.blogsmithmedia.com/www.tuaw.com/media/tuaw-cafepress-promo.png)


Reader Comments (Page 1 of 2)
Brian Allen said 10:48PM on 10-09-2006
You can simplify the "man" instruction to simply:
man pmset
There is no need for the extra returns.
Reply
Luke James said 2:44AM on 10-10-2006
does this stick after a restart?
Reply
someone said 11:49PM on 10-09-2006
wow, what a coincidence. here on the opposite side of the country, i just set this up for someone at the genius bar the other day.
you can even make a pair of files to switch it on and off. just make two text files with the only line in them being the commands:
sudo pmset 0
and
sudo pmset 1
and name them something like "Lid Wake On.command" and "Lid Wake Off.command" the first part isn't important, but the ".command" is.
Next, you'll need to make them executable. In the terminal, type
chmod +x
(with a trailing space), and drag the two files into the window. Press return, and now you have a pair of double-clickable files that, when activated, will open the terminal, enter the command, and wait patiently for your password (if sudo needs it).
you can also add this line at the beginning for a little more feedback:
echo "Enabling wake on lid open..."
or
echo "Disabling wake on lid open..."
and it will print out on the first line so you can make sure the right thing is happenning.
--someone
Reply
Christiaan said 12:47AM on 10-10-2006
I play music out sometimes, and would really like to be able to shut my laptop without it going to sleep. Can I use a similar command, something like...
"sudo pmset lid*sleep* 0"?
thanks
Reply
Nick said 12:26AM on 10-10-2006
Does this work with the ipod disconnecting? The other day, I closed the 'Book, then pulled the iPod off (without properly disconnecting), which awakened my laptop, meaning reopen, wait a second or two, then closing.
So, anyone wanna test before I open up the Unix prompt?
Reply
Taylor Mitchell said 12:32AM on 10-10-2006
Nick - I don't mean to sound rude or anything like that, but why don't you just try it yourself ?
It isn't terribly difficult to set it back to the default.
Reply
Laurie said 1:06AM on 10-10-2006
Christiaan - you don't want to do that. See above where I speak of overheating? You really don't want to shut your laptop without putting it to sleep for the purpose of playing iTunes.
Reply
Jon said 10:50AM on 10-10-2006
"Does this work with the ipod disconnecting? The other day, I closed the 'Book, then pulled the iPod off (without properly disconnecting), which awakened my laptop, meaning reopen, wait a second or two, then closing."
I've had kernel panics before when unplugging external devices when in sleep mode (for some reason it didn't wake automatically). I had to restart the machine, which is a lot more annoying than having to wait 2 seconds before sending it back to sleep again.
Reply
Chris said 2:14AM on 10-10-2006
Was wondering if anyone knows how to set the levels of brightness in firmware etc. Would like the be able to set the brightness levels controlled by the function keys to different amounts. Default amounts are too linear and minimum brightness is way too high.
Reply
presodent said 3:19AM on 10-10-2006
thanks for the tip. works fine and it was the first time i've tried a terminal command. now, how would you go about and turning off this feature?
Reply
wackybit said 11:40AM on 10-10-2006
Hey Laurie: I've been using Insomniac (or sleepless) for a while now. By using these two programs, I can walk around from class to class with my IM program still signed on and the downloads still downloading. I've never experienced any overheating at all.....
And if you want to attract attention, also open up audio hijack and have it hijack itunes to make the speakers really loud. Then you can walk around campus with that ghetto blaster in your hand!
And Christiaan, you can go to www.versiontracker.com and search the two programs i mentioned.
Reply
Mike Heinz said 7:41AM on 10-10-2006
Laurie, You're overreacting - it's fine to run a powerbook or ibook with the lid closed, as long as it has ventilation.
Haven't you ever heard of running a PB with an external monitor and keyboard? There are even instructions for doing it in my powerbook owner's manual!
Reply
chainlapper said 8:36AM on 10-10-2006
WOW!
A friend of mine has the MacBook, and once he found it totally exausted because of the issue. SO I gave him the link and now we're drinkin' the beer he has brought me for this, so THANK YOU FOR THE BEER!!! :))
Reply
peekytoe said 8:57AM on 10-10-2006
correct me if i'm wrong...but i thought it wasn't a good idea to carry around a mac notebook (or any laptop) while it's sleeping. someone once told me that the HD was more "vunerable" when the computer was sleeping, opposed to being completely turned off. i know about the sudden motion sensor and everything...but still. am i being too paranoid here?
Reply
Misanthrope said 9:26AM on 10-10-2006
Thank You for the great tip. Warm regards.
Reply
Aly said 8:38AM on 10-15-2006
Had a look around the pmset commands but couldn't see what I'm looking for. A command to stop my mac waking when USB is connected or disconnect? Anyone?
Reply
Mike Rose said 11:43AM on 10-10-2006
a) Yes you can run your laptop closed with an external display, mouse & keyboard connected: see here --
http://docs.info.apple.com/article.html?path=Mac/10.4/en/mh1963.html
b) Yes, if the machine ACCIDENTALLY wakes up and is running display, etc. while in a knapsack or other enclosed location, overheating is a real danger.
Thanks for the heads-up Laurie! I know you had to hold your nose to give us a Terminal-related tip. :-)
Reply
niclet said 10:53AM on 10-10-2006
@ peekytoe
I think it's fine: I carry my PB almost exclusively in sleep mode for about two years now and it still working A1. Sure if it is abused, it probably won't help, but to drop a PB/MBP/iB/MB on the floor in sleep mode or not doesn't make a big difference. Then, a good padding sleeve and bag to protect it from the blows is a solution.
Reply
Aron T said 11:31AM on 10-10-2006
From the "detailed comparison chart" viewable online: "When you connect an external display or projector to a MacBook or MacBook Pro, you can make presentations to large groups, extend your workspace, or work with the lid closed."
=aron=
Reply
presodent said 1:27PM on 10-10-2006
does anyone know how to "undo" or turn off this command after I have enabled it and used it on my laptop?
Reply