Listening to music with MacBooks lid closed

Solution 1:

Your MacBook will normally always go to sleep when you close the lid, and that unfortunately will stop the music playing.

But there is a way to stop your Mac from going to sleep when you close the lid with a simple shell command.

Disable sleeping when lid is closed:

sudo pmset -a disablesleep 1

Re-enable sleeping when lid is closed:

sudo pmset -a disablesleep 0