I have a MacBook Pro connected to a Dell 4k monitor, no extra keyboard, mouse, or trackpad, just my notebook and the display.

When I’m done working, I just want to close my laptop’s lid, putting it into sleep mode, and leave. But on MacOS Sierra, if your computer is connected to an external display it doesn’t sleep. Apple calls it clamshell mode.

I googled for a solution, but it looks like lots of people wanted to close the MacBook’s lid and keep working since MacOS Lion, and Apple implemented it. It was easy to learn the term clamshell mode, but finding a solution to stop it was not so easy.

Avoiding clamshell mode

After some time I finally found the solution to put my computer and my monitor to sleep by just closing the Macbook’s lid.

Phil Pirozhkov created a solution for us. It’s a terminal script that does the magic. Don’t worry, if you buy an external keyboard and mouse later, you can uninstall it.

Go to his Github page and be happy!