Sometimes you want to stop your computer from going to sleep, while you go doing something else.
Of course, you can go to your System Settings and completely turn off sleep mode, but then you’ll probably forget to turn back on again and waste a lot of electricity.
Instead, you can do it directly in your Mac Terminal.
Open up your Terminal (CMD + Space, then search for Terminal and hit Enter when it shows up to open it).
Then run this command:
Now your Mac will stay awake until you cancel this process by pressing CTRL + C.