In Mac, there are several apps that you can install to prevent the system from “sleeping”, however, these apps are mostly unnecessary because you can easily do so with this command. Open the terminal and type:
This command will prevent your Mac from sleeping. To stop it, simply press “Ctrl + c” to terminate it. Note: This is only a quick example of what caffeinate can do. You can also append -d, -i, -s,-u, or -t flag for more advanced option.