How to prevent a MacBook laptop from sleeping when closed with no external keyboard, mouse, or screen

audiobluetoothclosed-clamshellkeyboardsleep-wake

Context/goal:

I have a 2008 MacBook pro (running El Capitan with the latest updates) that I want to use as a media center/server.

It will be controlled exclusively via Screen Sharing and remote control apps (like Kodi/XBMC, Airfoil, etc). It's stored underneath my TV, which doesn't allow enough room for the laptop to stay open, so it has to be closed. I know that MacBooks can get hot if run while closed; it's not covered on any side where it sits, so it should be able to stay cool.

The laptop will always be connected to HDMI and speakers. The TV and speakers may not always be on; sometimes just the speakers will be on (e.g. for audio streaming).

It will be constantly connected to wired internet/Ethernet. My shared wireless connection is spotty, so it will often not be connected to WiFi.

Question:

I need the laptop to stay on without going to sleep. There are reams of advice on the internet for how to enable clamshell mode. However, in my case, there's no external dock, mouse, keyboard, or thunderbolt peripheral connected.

How do I prevent a closed, disconnected-from-everything MacBook running OSX 10.11 from going to sleep?

There are lots of similar questions on StackExchange and the internet, but none of them that I've seen deal with laptops that will be disconnected from everything but internet and speakers; most other questioners seem to want to use an external monitor or dock-like device.

What I've tried:

I zapped the PRAM/PMU before starting tweaking stuff to ensure that there were no stale settings lingering around.

  • Disabling sleep entirely while on AC/battery.
  • I tried various nvram commands to disable the internal display. While the internal display then didn't stay lit up during other attempts in this section, this did not seem to change sleep behavior.
  • Temporarily connecting a Bluetooth keyboard, so there's at least a disconnected Bluetooth peripheral to make it consider clamshell mode. I don't want to use a Bluetooth device to control the media center in the long term; screen sharing other apps only. No luck; with the TV disconnected or off, even a connected Bluetooth accessory seems to make it go to sleep as soon as Screen Sharing is disabled.
  • Enabling Internet Sharing, File Sharing, and the Bluetooth PAN. This doesn't consistently work; it seems to work more consistently when a WiFi connection is available, but my apartment's WiFi is flaky and is often not connectible.
  • Installing InsomniaX and configuring various modes with it; this occasionally keeps the MacBook on while the TV is on and connected and a Screen Sharing session has ended, but does not seem to work for audio-only streaming.

Best Answer

I use a program called "NoSleep". It allows me to do exactly that - helps me download updates, for example, while I go home from work.

You can get it from here: http://www.macupdate.com/app/mac/37991/nosleep