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.

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

Read more
MacBook Air 13-inch M3
Apple reveals how to prevent your MacBook powering on when you open the lid — here's what to do
MacBook Pro M3 Pro on bench
Stop using Command+Shift+3 — try these Mac screenshot shortcuts instead
MacBook Pro M3 Pro on bench
Your Mac has a built-in screen recorder — here's how to use it
A woman with curly black hair sleeps next to a man with light brown hair, both covered by a white comforter
3 quick ways to sleep fast come day or night— no sleep aids required
Young woman is wide awake at night and wants to fall back to sleep fast
Waking up at 3am? Here's 5 reasons you can't sleep through and 5 solutions
A woman laying awake at night with arms overhead as she is waking up every hour
3 reasons you're waking up every hour at night — and how to stop it
Latest in macOS
Mac Studio on a desk hooked up to a Studio DIsplay
Mac Studio M3 Ultra: 3 reasons to buy and 2 reasons to skip
Cyberpunk 2077 on MacBook Pro
5 great cloud gaming services for Mac that you should try right now
MacBook Prime Day
The widget you've always wanted comes to your Mac menu bar in Sequoia 15.2
Apple Magic Mouse USB-C
USB-C Mac accessories don't work with older macOS versions — this is a huge pain
How to keep to keep iCloud Drive files downloaded on your Mac
How to keep to keep iCloud Drive files downloaded on your Mac
How to access your passwords from the menu bar in macOS Sequoia
MacOS Sequoia lets you view saved passwords via the menu bar — here's how
Latest in How To
What size air purifier do you need? We ask the experts
ChatGPT on iPhone
5 mind-blowing ChatGPT prompts you’ll wish you knew sooner
Bulbs on a planting table
7 bulbs to plant in March for the best summer blooms
iRobot Roomba Combo 10 Max on hardwood floor
Don’t let your Roomba overflow — here's how to empty it
Cleaning bathroom taps
A professional cleaner just revealed the most obvious bathroom cleaning hack, and I'm shocked I never thought of it
Roomba i3
How to clean your Roomba for peak performance — 5 easy steps