Use a Terminal command to stop your Mac from sleeping


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. 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.

In these instances, you could go to System Preferences > Energy Saver and use the slider to tell your Mac to “never” sleep. 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.

Instead, there’s a built-in terminal command that can temporarily keep your Mac awake and prevent all sleep settings. This command is appropriately called caffeinate.

This is a really clever little hack. I give presentations on my Macbook Pro all the time and I’m constantly swiping the trackpad to prevent the machine from going to sleep (even when I don’t have to). You need to remember that you’ve invoked it. The easiest thing to do would be to leave the Terminal open during your presentation. That would remind you to undo the hack after your presentation is over.

  • Why not install Caffine by Light Head? Same thing but you just click an icon…

    • Jennieeevans

      Google is paying 97$ per hour! Work for few hours and have longer with friends & family! !mj355d: On tuesday I got a great new Land Rover Range Rover from having earned $8752 this last four weeks.. Its the most-financialy rewarding I’ve had.. It sounds unbelievable but you wont forgive yourself if you don’t check it !mj355d: ➽➽ ➽➽;➽➽ http://GoogleFinancialJobsCash355DirectVideoGetPay$97Hour ★★✫★★✫★★✫★★✫★★✫★★✫★★✫★★✫★★✫★★✫★★✫★★✫★★✫★★✫★★✫★★✫★★✫★★:::::!mj355d:….,…..

    • Yup, I recommend Caffeine, too. You can set it to activate for a preset length of time, too, so you don’t have to worry about remembering to turn it off at all.

  • I have occasionally used a combination of shell commands to warm my office. Has something to do with generating the md5 of an infinite sequence of “yes,” but I’ll leave the exact command up to Google. 🙂

  • David Stewart

    I use KeepingYouAwake ( ) which is a Caffeine clone and puts a little coffee cup in the menu bar which you can click to toggle it. I find it exceptionally helpful in reducing sleep induced frustration.