MacOS – prevent a remote Mac from entering sleep via a remote ssh connection

macossleep-wakessh

Since I upgraded to Mountain Lion, i've the feeling my Mac (early 2008 iMac) goes to sleep randomly when i'm connected through SSH.

It's there a way I can prevent my Mac to go to sleep when i'm connected over SSH ?

Best Answer

Caffeine prevents your Mac from falling asleep. Maybe, it can help you out with your issue too. The sleep isn't at all random, but in fact is set in the Energy Saver system preference as well from the terminal using pmset.

You could use pmset to inspect and change the sleep settings if you have admin rights on the remote.