Caffeinate macOS: How to prevent your Mac from going to sleep

MacOS was developed to be a highly stable and power-efficient operating system. When it detects the ability to save power by turning the display off or going to sleep, it will. But sometimes you don’t want to make to go to sleep. If only you could give it a cup of coffee.

Caffeinate is a Terminal command that will keep your Mac awake

To use it, navigate to Terminal by going to Applications > Utilities > Terminal.

Then, type and hit return:

caffeinate

That’s it. As long as that command is running, your Mac won’t go to sleep.

To end the process, click inside the Terminal window, and press Command ⌘ + W. A sheet will ask you if you would like to end the processes. Click Terminate.

You can also specify to run caffeinate for a specific period of time. Just use -t followed by the number of seconds. For example, to stay awake of an hour use (60 times 60):

caffeinate -t 3600

Your Mac will stay awake for that period of time and then resume normal operation.

 


Alex David

About the Author: Alex David

Hey, I'm Alex! I've spent the past 15 years working with tech. I've been an Apple fan since my family's first Mac in 1995, and I love using every Apple product line. If you have any feedback, please let me know!