MacBook Air sleep with external monitor attached I would like my MacBook Air running Yosemite to sleep once I close the lid, even if an external monitor is attached.

Before Yosemite this could be achieved with sudo nvram boot-args=iog=0x0. This has stopped working after the upgrade.

Is there another or a new way to achieve the effect I want?
You have to disconnect it from power. Then it will sleep.
Seems like no other solution is found yet.

And your question seems to be a duplicate — How to disable Clamshell mode in Yosemite?