

When you’re done with your presentation or whatever it was that you wanted your Mac to stay awake for, just click on Terminal to make the window active and use the keyboard shortcut Control-C. While the caffeinate command is running, everything will operate as normal on your Mac, except that it will not go to sleep regardless of your sleep settings in System Preferences. Nothing will appear to happen, but if you look closely you’ll see the Terminal cursor sitting on a blank line and you’ll notice that the Terminal status bar now says “caffeinate.” There’s no fancy user interface here, but this means that the command is working. At the Terminal prompt, enter the following command and press Return: To use the caffeinate command, first launch the Terminal app, located by default in Applications > Utilities (you can also find Terminal by searching for it via Spotlight). This command is appropriately called caffeinate. Instead, there’s a built-in terminal command that can temporarily keep your Mac awake and prevent all sleep settings. But this isn’t ideal, as it both involves a few extra steps and you may forget to set it back when you’re done. In these instances, you could go to System Preferences > Energy Saver and use the slider to tell your Mac to “never” sleep.

But sometimes we intentionally don’t want our Macs to sleep, such as when preparing to give a Keynote presentation or when you’re letting a colleague or family member use your Mac. We generally want our Macs to sleep when not in use: saving battery life, reducing energy usage, and increasing the longevity of our Mac’s components. Use a Terminal Command to Stop Your Mac From Sleeping
