This macOS hack stops your Mac putting itself to sleep

MacBook Air M2 2022
(Image credit: Tom's Guide)

If you want to stop your Mac sleeping, there's a couple of ways you can go about it. The first and most obvious way is to go through the System Preferences Power menu and change the amount of time until the Mac goes to sleep to "Never".

However, there is a common scenario where that method just won't work: if you don't have system admin rights. The Power menu, where you adjust the sleep timer preferences, can be locked behind an administrator password. If you're on a machine managed by an employer (like me), or you're using a Mac owned by someone else, you may not be able to change the display timer settings. For me, this leads to my MacBook Pro always going to sleep after 2 minutes when I'm not plugged in. 

Thankfully, there's a way you can get around this using a simple Terminal command.

Here's how to stop your Mac sleeping using Terminal.

How to stop your Mac sleeping using 'caffeinate' in Terminal

1. Open Terminal. If you're not sure how, read our guide on how to open Terminal on Mac.

2. Type "caffeinate" and hit Enter.

(Image credit: Future)

And you're done. Your Mac will now stay awake as long as you don't close the lid on a MacBook. To decaffeinate, with the Terminal window open, press Cmd + W and click Terminate.

(Image credit: Future)

Now that you know how to stop your Mac sleeping, why not read our other macOS guides. We can show you how to clear the cache on Mac and how to reset the SMC on a MacBook Pro — both will help you speed up a sluggish Mac. We can also show you how to change the screenshot location on Mac and how can you set default apps on Mac.

Next: learn how to use the Automator on Mac to simplify your processes.

Peter Wolinski
Reviews Editor

Peter is Reviews Editor at Tom's Guide. As a writer, he covers topics including tech, photography, gaming, hardware, motoring and food & drink. Outside of work, he's an avid photographer, specialising in architectural and portrait photography. When he's not snapping away on his beloved Fujifilm camera, he can usually be found telling everyone about his greyhounds, riding his motorcycle, squeezing as many FPS as possible out of PC games, and perfecting his espresso shots.