When you close the lid of your MacBook, it goes to sleep. There's no system setting you can tweak, and no command you can run, to change this
But, just like reported here -- My MacBook Pro doesn't sleep when its lid is closed. I'm sure because I have an external monitor:
- when my Mac is plugged in and I close its lid, the external monitor goes black immediately, then goes all the way to sleep (takes about five or six seconds), the orange light turns on, but that last only for about two seconds, after that power light become green again, and the monitor eventually lights up. It'll response to my mouse move/click, even the lid remains closed.
- If is on battery, when I close the lid, MacBook goes to sleep.
I hope this is a well known issue and there is an easy fix, because this is a brand new MBP, and I'm really really new to Mac and don't know much about it.
System Version: macOS 10.15.7 (19H2) Kernel Version: Darwin 19.6.0