Disable Wake From Sleep When Opening the Lid of a MacBook Pro

Apr 26, 2011 - 7 Comments

Terminal in OS X

If you don’t want your MacBook Pro to wake from sleep when you open the lid of the machine, all you need to do is launch the Terminal and type the following command:


sudo pmset lidwake 0

Changes take effect immediately, and you can verify this is working by using the -g profiles flag below, or just by closing the lid to force the MacBook to go to sleep. Now when you open the lid, the Mac will not wake from sleep. This will work on the MacBook, MacBook Pro, and MacBook Air.

You can set this back to default behavior (ie: waking from sleep when the lid is opened) with the following command:

sudo pmset lidwake 1

Again, changes take affect immediately.

If you want to check your pmset settings, use the following command:

pmset -g profiles

You’ll see something like this, grouped by Battery and AC power sources:

womp 0
sms 1
hibernatefile /var/vm/sleepimage
ttyskeepawake 1
acwake 0
sleep 0
autorestart 0
halfdim 1
hibernatemode 3
disksleep 10
displaysleep 15
lidwake 0

Anything with a 1 next to it indicates that feature is enabled, a 0 is disabled. The ‘hibernatefile’ or sleepimage is where the contents of your Mac are kept when you sleep the machine, this serves as a cache file and can grow quite large depending on your RAM. If you want to learn more about the rest of the pmset functions, use ‘man pmset’ at the command line.

pmset is a powerful utility that offers a lot of customization for Mac OS X power management. Using pmset, you can temporarily prevent a Mac from sleeping, schedule Mac boot and sleep/wake times, disable the sudden motion sensor, and much more.

.

Related articles:

Posted by: David Mendez in Command Line, Mac OS

7 Comments

» Comments RSS Feed

  1. Rezwan says:

    my lidwake is not working suddenly and when I close my display it doesn’t go to sleep mode.. please can u help me out ..

  2. Alberto says:

    “You can set this back to default behavior (ie: waking from sleep when the lid is opened) with the following command:”

    Hmm… How can I use the Terminal if the Mac is sleeping?

  3. Philipp says:

    Anybody knows a command to prevent the mac from waking up when adding or removing usb devices?
    Or maybe event prevent it from waking up on key presses?

    I want my macbook to only wake up when opening the lid or pressing the power button.

  4. MacGeek says:

    This is an absolute MUST tip to use if the hinge is damaged on your MacBook Pro preventing it from keeping shut as well as it should.

    As slunce says, some of the lids will pop open and your MacBook will wake up from sleep if stored in a case or backpack while you’re walking around, once the Mac wakes up it doesn’t sleep and it will drain your battery. This prevents that from happening.

  5. qka says:

    But why?

    “Because you can” sounds like something I would expect to hear from Apple’s competitors.

    • slunce says:

      because 2007 macbook pro has got crappy lid and wakes up not only when opened but also when the notebook is carried whilst closed.

Leave a Reply

 

Shop on Amazon.com and help support OSXDaily!

Subscribe to OSXDaily

Subscribe to RSS Subscribe to Twitter Feed Follow on Facebook Subscribe to eMail Updates

Tips & Tricks

News

iPhone / iPad

Mac

Troubleshooting

Shop on Amazon to help support this site