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 there is a major exception to this rule, and another third party program that gives you control.
We told you how to keep your Mac from falling asleep, but this is a little different. Say you want your MacBook running while its closed, so you can free up desk space or leave it as a server running for remote access. You have two options.
Without Third Party Software: Plug in an External Display
By default, your MacBook will go to sleep the second you close the lid. But there is one exception, as Apple explains here. To summarize, your MacBook will stay awake while closed if:
- The power supply is connected, and
- An external display is connected, and
- An external mouse and keyboard is connected. USB and Bluetooth both work.
If you have all of that, you can close the laptop without it going to sleep, turning your laptop in an improvised desktop computer. If you’ve got a large display taking up your entire desk, this is probably the best way to use your MacBook.
If your Mac is running macOS 10.7 (Lion) or later, you can simply open your MacBook to re-enable its display. If you’re using an earlier version of macOS, such as 10.6 (Snow Leopard) or earlier, this won’t work. Don’t panic: you just need to put your Mac to sleep, unplug the display, then close and open it.
Without an External Display: Use InsomniaX
What if you want to keep your MacBook running closed without connecting an external display and inputs? You’ll need some sort of third party program to do that. We recommend InsomniaX, a free program that runs from the menu bar. Download the application and you’ll have a .TGZ file.
You’ll need to install The Unarchiver to open this compressed file and reveal the app itself.
To install InsomniaX, drag the program to your Applications folder. Run the program and you’ll find it in the menu bar.
When “Disable Lid Sleep” is checked, you can close your MacBook without it going to sleep. If all you want to do is close your MacBook and let it keep running, the easiest thing to do is to just check that option. “Disable Idle Sleep”, meanwhile, will prevent your Mac from going to sleep at all, the same way programs like Amphetamine or Caffeine do.
Below that you’ll find the option to disable lid or idle sleeping for a certain amount of time. Click these options and a window with a slider will open.
Pick how long you want your Mac to stay awake, and you’re good. If you just want your Mac to stay awake long enough to finish a download, or play a particular album, this might be a good option for you.
You’ll find a few more options under “Preferences.”
For example, you can specifically disable going to sleep when the lid is closed if the power supply is plugged in. The “CPU Safety” function will allow your Mac to go to sleep in the event of potential overheating. You can also set keyboard shortcuts for triggering both lid and idle sleeping.
That’s about it! For the most part I recommend you simply open InsomniaX when you want your Mac to stay awake while closed, and don’t open it otherwise. The application is passive, meaning your settings will not be remembered when you restart your Mac and open InsomniaX again.