Why won't closing the lid sleep my MacBook Pro with external monitor attached after upgrading to Lion?

Solution 1:

edit: See this as the behaviour has changed: Why won't closing the lid sleep my MacBook Pro with external monitor attached after upgrading to Lion?

There are two groups of people. Those who wish to have dual displays and have closing the lid go into sleep and people who wish to disable the monitor display, close the lid and use the external monitor as if you had 'docked' with it.

Previously, if you wished to switch from the macbook to an external monitor entirely then you had to perform the following to put the laptop into clamshell mode:

  1. Make sure the computer is plugged in to an outlet using the AC power adapter.
  2. Connect a USB keyboard and mouse to your computer.
  3. With the computer turned on connect the Apple portable (using the appropriate Apple adapter if necessary) to the appropriate port on the external display or projector and turn the display or projector on.
  4. Once your computer's Desktop appears on the external display, close the computer's lid.
  5. Once the lid is closed, wake the computer up by either clicking your mouse button or by pressing a key on your external keyboard.

source: http://support.apple.com/kb/ht3131

So to put the machine in clamshell mode required you to put it to sleep and wake it back up again. As far as user experience goes, that is somewhat jarring.

As you have the other options to put the machine to sleep, it seems very likely that this change will remain.

Right now, there is no way to alter this behaviour.

Solution 2:

if there's a setting to restore the sleep-on-close behavior

Yes, there is. To restore Snow Leopard behavior just run the following command in the Terminal while the external monitor is disconnected and reboot:

sudo nvram boot-args=iog=0x0

I've just used it on my Lion – works like a charm.

 
If you ever want to reset it back, either run the following (and reboot of course):

sudo nvram -d boot-args

or just reset your PRAM with ++P+R if for some reason you can't boot.