If your Mac is stood idle for a significant period of time, then you’ll usually want it to drift off to sleep.
Not only does sleeping help preserve your Mac’s battery life, but it’s also an important security feature that can help keep the contents of your Mac safe from prying eyes.
Assuming that you’ve password-protected your Mac (and you really should!) once your Mac has been asleep for a significant period of time, it’ll go into lockdown and you’ll need to enter a password before you can continue using it. This is a handy security feature if you’re in the bad habit of wandering off and leaving your Mac running, at which point anyone in the area could potentially access your Mac and its contents.
Hopefully, the worst that’ll happen is your colleague or housemate plays a practical joke on you, but even discovering that someone has been posting strange things to your Facebook in your absence is annoying!
Sleep is a useful feature, but sometimes your Mac may simply refuse to go to sleep, no matter how long it’s been stood without user input. If you return to your Mac after a break only to discover that it’s been sat there, awake, the entire time, then you’ll want to find out exactly what’s causing your Mac’s insomnia.
Check your Energy Saver Settings
Let’s start by ruling out the obvious: double-check that your Mac actually is configured to go to sleep after it’s been stood inactive for a period of time.
- Click the ‘Apple’ logo in your Mac’s toolbar.
- Select ‘System preferences….’
- Select the ‘Energy saver’ pane.
The ‘Turn display off…’ slider shows how long your Mac needs to be left without user input before it drifts off to sleep. Check the slider in the ‘Battery’ and ‘Power Adapter’ tabs, and make sure they’re both set to a reasonable amount of time.
If either of these sliders are set to ‘Never,’ then you’ve found the reason why your Mac never seems to sleep!
Investigating with Activity Monitor
Some apps and processes can keep your Mac awake indefinitely, so you should take a closer look at exactly what’s running on your Mac.
Open your Mac’s built-in Activity Monitor by opening a new ‘Finder’ window and navigating to ‘Applications > Utilities > Activity Monitor.’
Open the ‘Energy’ tab and you’ll see a ‘Preventing sleep’ column. Any processes that are marked with a ‘Yes’ have the potential to prevent your Mac from going to sleep, so you should close the related app and then see whether this has solved your problem.
Investigating with the Terminal
If you can’t spot any obvious culprits in the Activity Monitor, then it’s time to dig a little deeper.
The macOS system supports a feature called power assertions, which programs can invoke if they need to prevent the system from going to sleep.
You can check whether any of these sleep assertions are currently active, by launching your Mac’s Terminal. Open the Terminal by navigating to ‘Applications > Utilities > Terminal’ and then issue the following command:
pmset -g assertions
This command returns quite a bit of information.
The first section is a list of all the different categories of assertions. A 0 next to a category means it isn’t active, but a 1 means that this assertion is currently active.
Below this list, you’ll find information about the specific processes that are invoking any active assertions, although this information does take a bit of deciphering.
Here’s a snippet of my Terminal output:
Listed by owning process:
pid 182(coreaudiod): [0x0000022a00018162] 00:00:08 PreventUserIdleSystemSleep named: “com.apple.audio.AppleHDAEngineOutput:1B,0,1,1:0.context.preventuseridlesleep”
Firstly, ‘pid’ stands for Process ID, and the number immediately after it is the actual process ID.
You can use this number to identify the process in your Mac’s Activity Monitor, so launch the Activity Monitor and then open either the CPU, Memory, Disk or Network tabs. All of these tabs contain a PID column, so work your way down the list, looking for the same process ID you identified in the Terminal.
Some processes will only appear in certain tabs, so you may need to work your way through several Activity Monitor tabs before you find the process you’re looking for.
Once you’ve located the process, you’ll see its related application in the Activity Monitor’s left-hand column. Simply closing this application may solve your problem and allow your Mac to drift off to sleep again, but sometimes you may need to force-quit the process itself.
You can close any process by selecting it in Activity Monitor and then clicking the ‘Force a process to quit’ icon in the upper-left corner. However, closing the wrong process (particularly system processes) can cause your apps to start misbehaving, and may even cause problems with the wider system, so you should never close a process without knowing exactly what work this process is responsible for.
If in doubt, then take some time to research the process online, and if you’re still unsure then play it safe and leave the process well alone!
Before you go
After spending over 20 years working with Macs, both old and new, theres a tool I think would be useful to every Mac owner who is experiencing performance issues.
CleanMyMac is highest rated all-round cleaning app for the Mac, it can quickly diagnose and solve a whole plethora of common (but sometimes tedious to fix) issues at the click of a button. It also just happens to resolve many of the issues covered in the speed up section of this site, so Download CleanMyMac to get your Mac back up to speed today.