A simple and effective way to avoid Apple OSX for sleep is with the terminal command:
$ pmset noidle
Preventing idle sleep (^ C to exit) ...
The only unpleasant thing that maybe the user must finish this manually is by issuing "Control-C".
source share