Why Does My Mac Keep Going to Sleep? Causes and Fixes
Your Mac keeps going to sleep because a timer ran out, the lid closed, or something like a hot corner or a low battery triggered it. Your Mac logs the reason. Read the log, then change the one setting that matches.
Macky puts your Mac's terminal and screen on your iPhone, which helps once you've stopped the sleeping and want to check on the Mac from somewhere else.
Find Out Why Your Mac Went to Sleep
Open Terminal and run:
pmset -g log | grep "Entering Sleep"Each line ends with a reason. One third-party guide (slack.green) lists these common ones:
- Idle Sleep: no input until the timer ran out.
- Clamshell Sleep: the lid was closed.
- Software Sleep: an app, a hot corner, or you chose Sleep.
- Low Power Sleep: the battery ran low.
- Maintenance Sleep and Sleep Service Back to Sleep: brief background wakes, which that guide calls normal.
To see what is holding your Mac awake right now, run pmset -g assertions. Activity Monitor shows the same thing in the "Preventing Sleep" column of the Energy tab. To see your active timers, run pmset -g custom.
Change the Sleep Settings
- Display timers: System Settings > Lock Screen. Set "Turn display off on battery when inactive" and "Turn display off on power adapter when inactive".
- MacBook: System Settings > Battery > Options. Turn on "Prevent automatic sleeping on power adapter when the display is off".
- Desktop Mac: System Settings > Energy. Turn on "Prevent automatic sleeping when the display is off".
Apple warns that delaying or preventing sleep may increase power use.
Check on Your Awake Mac from Your iPhone
You can check on your Mac from your iPhone once the sleeping stops. Macky opens your Mac's own shell on your phone. You can run pmset -g assertions from the couch.

The Mac app also has a keep awake switch and a closed-lid mode. The connection is end-to-end encrypted with no open ports.
Stop Sleep Temporarily with caffeinate
Use caffeinate when you only need the Mac awake for a while. Run this and press Control+C to stop it:
caffeinate -diThe -d flag prevents display sleep. The -s flag only works on AC power, because macOS ignores that assertion on battery. caffeinate creates temporary assertions and changes no saved setting. More flags are in caffeinate on Mac.
Other Causes to Check
- Hot corners: System Settings > Desktop & Dock > Hot Corners. A corner set to sleep can trigger it by accident.
- Low Power Mode: System Settings > Battery. Turn it off to test.
- Closed lid: see how to keep a MacBook awake with the lid closed.
- Headless Mac mini: see the headless Mac mini guide.
If the Mac sleeps while you're using it, check the display timer and hot corners first. Then read the log again after the next sleep.
FAQ
How do I make my MacBook screen stay on?
Open System Settings > Lock Screen and raise the display timers, "Turn display off on battery when inactive" and "Turn display off on power adapter when inactive". For a one-off, run caffeinate -d in Terminal.
How do I get my MacBook to stay awake longer?
Raise the sleep timers in System Settings > Lock Screen. On a charger, turn on "Prevent automatic sleeping on power adapter when the display is off" in System Settings > Battery > Options. Apple notes this may increase power use.
Why does my Mac keep going to sleep while I'm using it?
Check the display timer in System Settings > Lock Screen and the hot corners in System Settings > Desktop & Dock > Hot Corners. Then run pmset -g log | grep "Entering Sleep" to see the logged reason.
Related Guides & Comparisons
Try Macky
Connect to your Mac terminal from your iPhone.