I have experienced Mountain Lion on a Mac mini will go to sleep regardless of the Energy Saver settings in the System Preferences. After some reading, it seems OS X Mountain Lion has very aggressive power management, which will put the system to sleep against your (my) will.
This is my attempt to create a Launch Agent, which will use the system command caffeinate
to prevent sleep indefinitely.
Copy the plist into ~/Library/LaunchAgents
, then, in a Terminal session, run the command to load it up:
launchctl load ~/Library/LaunchAgents/com.sprocketlight.wakey-wakey.plist
http://arstechnica.com/apple/2012/07/os-x-10-8/18/
http://useyourloaf.com/blog/2012/08/09/keeping-mountain-lion-awake.html