In OS X Mountain Lion, Apple has bundled a command line tool for disabling sleep, named caffeinate.
Caffeinate can prevent sleep entirely, but you can also modify the command with various arguments to prevent just the display from sleeping, provide a specified time to avoid sleeping, prevent sleeping while a command runs, and more.
To temporarily disable sleep, run this command from Terminal:
caffeinate
You can also run caffeinate for a set amount of time to prevent sleeping:
caffeinate -t 21600
The number attached to the -t flag is the amount of time in seconds for sleep to be disabled.
Caffeinate can also be attached to other commands to prevent the Mac from sleeping while the command runs:
caffeinate [command_to_run] -arguments
That causes the Mac to avoid sleep only as long as it takes to run the command provided, after which the normal sleep rules apply.
Via : MacOSXHints
Leave a Reply