In this Quick Tip we briefly covered some reasons you may want to prevent your Mac from sleeping, how to use the caffeinate command, and lastly I shared some applications that available to users who may prefer the convenience of an application or may not have Mountain Lion installed on their machine.The table represents Parallels Desktop and macOS (as the main system) compatibility information. Should I Sleep on the Mac App Store by Marcelo Leite - $1.99.Caffeine on the Mac App Store by Lighthead Software - Free.Each of these includes different features, ranging from simple time settings to more advanced facical detection via the iSight camera, so I encourage you to look through them to find what best fits your needs. Luckily, developers have listened and provided a number of convenient and compatible options. Older versions of OS X, unfortunately, do not have the ability to use this command, and the convenience of an application can be difficult to beat. To learn more about caffeinate and other ways to use the command, visit the Mac Developer Library entry on caffeinate. -t - Specifies the timeout value in seconds for which the command is valid.If the display is off, this option turns the display on and prevents the display from going into idle sleep. This is valid only when system is running on AC power. -s - Prevent the system from sleeping.-i - Prevent the system from idle sleeping.-d - Prevent the display from sleeping.Using Caffeinate’s OptionsĪpple understands that each person using this command may have different needs and has provided a number of different options to let users decide what is needed in their situation. Tip: The brackets around the command ( ) are there for demonstation, but would not be used around a normal command such as open. This can be done in the following way:Ĭaffeinate -arguments The caffeinate command can also be linked to other commands, such as cloning a git repository, by linking caffeinate to a specific command. For example, if you wanted to prevent your Mac from sleeping for 5 hours, you would run the following command: Luckily, Apple has made this rather easy to accomplish by using the -t option to your command, followed by the time in seconds. Other times, you may prefer to set the duration you would like to prevent the Mac from sleeping. While running, caffeinate will leave a blank prompt.įor some situations, such as while watching a movie, this may be fine. To stop the process from running, you can press Ctrl+ C which will instantly end the process, and return you to the command prompt. While running, caffeinate will prevent your Mac from sleeping. When run, the cursor will move down to a blank line where it will stay until you tell the command to stop running or close the terminal. The simplest way to use this command is to run the following command in the terminal. The caffeinate command is used to prevent a Mac from going to sleep. Let’s take a look at how to use this command, and some alternatives for older machines. With OS X 10.8, Mountain Lion, we are able to stop our Macs from sleeping for a period of time from our command line with the caffeinate command. When in these situations, it can be inconvenient to look through System Preferences > Energy Saver until you find the settings needed and then you must remember to re-enable your original settings when you are done.
Yet there are times you may want to stop your Mac from sleeping such as when you’re watching a movie, cloning a large repository from GitHub, or need to let a large download finish from your favorite website. Computers sleep as a way to save energy and prevent unnecessary wear on your machine's hardware.