How can I keep a macbook running when the display is closed?
Solution 1:
If you have an external display, then just closing the lid generally works.
Apple calls this "closed clamshell" mode or closed display mode.
But if you only have the macbook, and you want to be able to close the lid without sleep, for instance to move it from one class to another at school without having to use sleep etc, then it's more tricky.
One option it to enable internet sharing in Preferences, this requires the OS to stay running in case anyone wants to connect, but it does potentially leave you open to unwanted connections.
Another way is to run an app like NoSleep to do the hard work for you, it's free - check the link.
But there is no simple setting for doing this built into the OS.
Solution 2:
When not connected to charger it doesn't work when Display is connected, so make sure to have it plugged in while using external Display and working with closed macbook.
Solution 3:
I posted an answer over to the similar question:
Is there any way to set a MacBook Pro to not sleep when you close the lid?
that applies to this question as well. Since I found this question in a search, others will too, so go there for the discussion.