Posted by (author unknown) at MacOSXHints.com
Since Mountain Lion was released, I find that my Macs go to sleep when I don’t want them to. I had my Energy Saver preferences set to 15 minutes, but I’ve noticed that when something is active, such as a download, they got to sleep after 15 minutes, rather than continue with the download. This is not only incorrect behavior, but it’s very annoying. What’s worse, when I changed the setting to Never, they would still go to sleep during long downloads.
The Ask Different blog pointed out that there is a new command in Mountain Lion called caffeinate. This keeps the system awake, or, as the man page says, “prevent the system from sleeping on behalf of a utility.”
Run it as follows in Terminal:
caffeinate -u -t 3600
3600 in the above command is the number of seconds to keep the system awake. What’s interesting is that you can effect …







