To keep your Mac awake, all you have to do is open Terminal on your Mac > Applications > Utilities > Terminal and enter the following command
pmset noidle
Screenshot
Other Methods
Check Energy SaverĀ – set computer sleep to ‘never’
Download and install NoSleep
Download and install Sleep No More
Download and install Should I Sleep
Download and install Caffeine