However, it can be frustrating when the computer goes to sleep while you are watching a movie, or just listen to songs.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:caffeinateThis command will prevent your Mac from sleeping.