Keep MacBook Pro awake in a clamshell mode + HDMI switcher setup I'm running a setup with the latest Retina MacBook Pro, a Windows desktop and a single external monitor. 

Both machines are outputting display to a HDMI switcher, which connects to the monitor. I can switch between the sources with a button on the switcher.

The problem is that everytime I switch to the Windows machine, the Mac goes to sleep since it's in clamshell mode and it has no display connected. The VPN connection I use for work on the Mac keeps disconnecting because the machine goes to sleep.

I've tried fiddling with the power saving settings and other third party programs (including Caffeine and NoSleep) that are supposed to keep the machine awake, but none worked so far.

I am running Mavericks 10.9.5 on the latest MacBook Pro model (SSD).

Any ideas on how to always keep the machine awake, even when I switch the display to the Windows desktop?
You can use caffeinate from the terminal.app.

Just open the terminal.app and type caffeinate

Without arguments it just stays awake until you ctr+C at the terminal. There are more arguments you can use in order to prevent different system components from sleeping.