You are doing something on your Mac, but your mom asks you to help her in something. You have to leave your Mac and help her and will get back to work later.
After a few minutes, you get back, but your Mac was automatically turned into sleep mode. You have to wake it up and keep working. It seems until you need to leave your Mac computer multiple times. Every time you get back, you always need to wake your Mac up again. Too annoyed?
Do you want to keep your Mac computer awake? Do you want to extend the time your Mac is awake? With a simple command line in Terminal, you can easily keep your Mac computer awake for a particular time or indefinitely.
Prevent Your Mac From Sleeping With “caffeinate” Command
To keep your Mac awake indefinitely, you can type “caffeinate” in Terminal. This command will keep your Mac computer awake until you cancel. Your Mac will never be turned into sleep mode unless you perform.
In order to execute the “caffeinate” command, press Command + Space to open Spotlight.
From the search box, type “Terminal” to open the Terminal application.
In the Terminal application, type:
Then press Enter.
That’s it! Your Mac computer will awake indefinitely.
Prevent Your Mac From Sleeping In A Specific Time
You can also set any duration you like for the “caffeinate” command. For example, if you only want to keep your Mac awake in one hour, just use:
caffeinate -t 3600 &
By adding an ampersand at the end of the command line, the “caffeinate” will run in the background and you will be able to continue to use the Terminal.
There are a few other arguments you should know:
- caffeinate -d to prevent your display from sleeping.
- caffeinate -i to prevent your system from idle.
- caffeinate -m to prevent your hard disk drive from idle.
- caffeinate -s to keep your Mac system awake while using AC power.
If you don’t like to use Terminal, you can go to System Preferences -> Energy Saver and then set the time your Mac computer will go to sleep mode.
Whatever method you choose to use, I’m sure you will find it easy to prevent your Mac computer from sleeping.
If you have any questions, please leave your comment below.