Become a MacRumors Supporter for $50/year with no ads, ability to filter front page stories, and private forums.

JoelBC

macrumors 65816
Original poster
Jun 16, 2012
1,026
86
I have a 2021 16" MBP which is currently running Monterey 12.1. I keep the MBP's lid open at all times.

I have the MBP configured for a) the display to turn off / sleep after 10 minutes and b) the Mac not to sleep when the display is off.

The MBP does not have a status indicator light meaning I can easily tell that the display is off / sleeping BUT how can I tell whether the MBP is / is not sleeping?

Would appreciate some answers / insight into how to do this.

Thx!
 

FocusAndEarnIt

macrumors 601
May 29, 2005
4,627
1,108
In console, go to Mac Analytics data. the process you're likely to glean the most info from is "powerd"
 

JoelBC

macrumors 65816
Original poster
Jun 16, 2012
1,026
86
In console, go to Mac Analytics data. the process you're likely to glean the most info from is "powerd"
Appreciate the response and happy to try it.

That said -- I am not very knowledgeable with Unix -- what do I type into the Terminal program to get all the available parameters that the pmset commands takes so I can get exactly what I want?

Thx!
 

bogdanw

macrumors 603
Mar 10, 2009
6,099
3,011
BUT how can I tell whether the MBP is / is not sleeping?
Leave some music on :)
In Terminal the command
pmset -g
displays the current configuration of pmset (manipulate power management settings)
This is my solution to completly disable sleep, standby, hibernation

Code:
sudo pmset -a disablesleep 1; sudo pmset -a standby 0; sudo pmset -a sleep 0; sudo pmset -a hibernatemode 0; sudo pmset -a autopoweroff 0;


After these commands, the file /var/vm/sleepimage is automatically deleted and not created again.
 

JoelBC

macrumors 65816
Original poster
Jun 16, 2012
1,026
86
Leave some music on :)
In Terminal the command
pmset -g
displays the current configuration of pmset (manipulate power management settings)
This is my solution to completly disable sleep, standby, hibernation

Code:
sudo pmset -a disablesleep 1; sudo pmset -a standby 0; sudo pmset -a sleep 0; sudo pmset -a hibernatemode 0; sudo pmset -a autopoweroff 0;


After these commands, the file /var/vm/sleepimage is automatically deleted and not created again.

A few follows up:

1. Are you saying that I should leave some music playing and in the event the music is still playing when I come back then the MacBook is not sleeping? If yes, then great idea!

2. I am not sure that I want the same settings that you have so it would be nice to know the syntax (inclusive of variable settings) for the entire peseta command.

3. Plus, based on my googling results, I am not sure that pmset is what I am looking for as I do not want to change any if the sleep settings, I just want to know whether the computer is sleeping or not. What is the best way to do that? Would love to have some form of SIL that could be disabled, just saying!

Thank you.
 
Last edited:

bogdanw

macrumors 603
Mar 10, 2009
6,099
3,011
pmset -g stats
"Prints the counts for number sleeps and wakes system has gone thru since boot."
pmset -g log
"displays a history of sleeps, wakes, and other power management events. This log is for admin & debugging purposes."
 
  • Like
Reactions: gilby101

JoelBC

macrumors 65816
Original poster
Jun 16, 2012
1,026
86
pmset -g stats
"Prints the counts for number sleeps and wakes system has gone thru since boot."
pmset -g log
"displays a history of sleeps, wakes, and other power management events. This log is for admin & debugging purposes."
Awesome, exactly what I am looking for, thanks so much.

One more thing, can you please explain the meaning of the following:

- By "since boot" you mean since most recently booted, correct?

- Dark Wake Count; specifically, what event(s) is this?

- User Wake Count; specifically, what event(s) is this?

Thanks.
 

bogdanw

macrumors 603
Mar 10, 2009
6,099
3,011
I never use sleep functions, so I might be wrong, but here’s my understanding of the values:
1. Yes.
(How to Check a Macs Uptime and Reboot History https://osxdaily.com/2009/09/22/check-your-macs-uptime-and-reboot-history/ )

2. There used to be a tool called darktool (https://opensource.apple.com/source/PowerManagement/PowerManagement-494.1.2/darktool/) that allowed setting the mac to wake from sleep to perform some maintenance tasks (like defragmenting the hard drive), without turning on the screen.
In newer versions of macOS, including Monterey, this “Dark Wake” refers most likely to “Wake for network access” and “Power Nap”.
https://support.apple.com/guide/mac-help/set-sleep-and-wake-settings-mchle41a6ccd/mac

3. When the user takes the computer out of the sleep state, so not exited based on a schedule or another event.
 

JoelBC

macrumors 65816
Original poster
Jun 16, 2012
1,026
86
I never use sleep functions, so I might be wrong, but here’s my understanding of the values:
1. Yes.
(How to Check a Macs Uptime and Reboot History https://osxdaily.com/2009/09/22/check-your-macs-uptime-and-reboot-history/ )

2. There used to be a tool called darktool (https://opensource.apple.com/source/PowerManagement/PowerManagement-494.1.2/darktool/) that allowed setting the mac to wake from sleep to perform some maintenance tasks (like defragmenting the hard drive), without turning on the screen.
In newer versions of macOS, including Monterey, this “Dark Wake” refers most likely to “Wake for network access” and “Power Nap”.
https://support.apple.com/guide/mac-help/set-sleep-and-wake-settings-mchle41a6ccd/mac

3. When the user takes the computer out of the sleep state, so not exited based on a schedule or another event.
Appreciate the response and the links.

I am therefore confused based on the below image:

Screen Shot 2022-01-08 at 07.03.52 AM.png


How is that I -- the User -- woke the computer once (i.e. User Wake Count: 1) when the computer never slept (Sleep Count: 0)?

Thanks.
 

bogdanw

macrumors 603
Mar 10, 2009
6,099
3,011
Maybe it counts displaysleep and/or disksleep under User Wake Count.
So, the mac did not sleep, but the display did.
 

JoelBC

macrumors 65816
Original poster
Jun 16, 2012
1,026
86
Maybe it counts displaysleep and/or disksleep under User Wake Count.
So, the mac did not sleep, but the display did.
Appreciate the response but I am guessing it is something else as my Mac is setup not to sleep while the display is setup to sleep and often does sleep meaning that based on your interpretation, I would have expected that number (i.e. User Wake Count) to be higher.

Thanks.
 

JoelBC

macrumors 65816
Original poster
Jun 16, 2012
1,026
86
Mystery solved :)
View attachment 1940829
"sleepnow - causes an immediate system sleep"
Appreciate that, the funny thing is that I do not recall ever issuing a command for the computer to sleep now but I guess I must have inadvertently done so when playing around with the pmset command.

That you for digging into this for me.
 

gilby101

macrumors 68030
Mar 17, 2010
2,921
1,616
Tasmania
Just to add to good comments by @bogdanw, I find this command useful to extract what I want from the power management log:
pmset -g log | egrep "\b(Sleep|Wake|DarkWake|Start)\s{2,}"
 
  • Like
Reactions: bogdanw

JoelBC

macrumors 65816
Original poster
Jun 16, 2012
1,026
86
Just to add to good comments by @bogdanw, I find this command useful to extract what I want from the power management log:
pmset -g log | egrep "\b(Sleep|Wake|DarkWake|Start)\s{2,}"

Awesome but so that I do not so something inadvertently can you please explain what pmset -g log | egrep "\b(Sleep|Wake|DarkWake|Start)\s{2,}" does?

Thx!
 

bogdanw

macrumors 603
Mar 10, 2009
6,099
3,011
The log generated with pmset -g log is very comprehensive. With grep/egrep only the desired values (Sleep|Wake|DarkWake|Start) are displayed.
Here’s another example that might be useful:
pmset -g log | grep 'Display is turned'
list the exact date and time of the events “Display is turned off” and “Display is turned on”
 
  • Like
Reactions: gilby101

JoelBC

macrumors 65816
Original poster
Jun 16, 2012
1,026
86
The log generated with pmset -g log is very comprehensive. With grep/egrep only the desired values (Sleep|Wake|DarkWake|Start) are displayed.
Here’s another example that might be useful:
pmset -g log | grep 'Display is turned'
list the exact date and time of the events “Display is turned off” and “Display is turned on”
Awesome, that is much much appreciated.

One follow up, what is the difference between grep and egrep as I tried both and they appear to provide the exact same results.

Thx.
 

gilby101

macrumors 68030
Mar 17, 2010
2,921
1,616
Tasmania
what is the difference between grep and egrep
From the man page for grep: "egrep can handle extended regular expressions (EREs)". Otherwise grep and egrep are the same.

pmset -g log | egrep "\b(Sleep|Wake|DarkWake|Start)\s{2,}" finds the words in the 'domain' field of each line. It doesn't work with grep.

Another I use (which produces similar results) pmset -g log | grep -e "Wake from" -e "DarkWake" -e "due to" which finds the three phrases anywhere in each line of the log.
 

JoelBC

macrumors 65816
Original poster
Jun 16, 2012
1,026
86
From the man page for grep: "egrep can handle extended regular expressions (EREs)". Otherwise grep and egrep are the same.

pmset -g log | egrep "\b(Sleep|Wake|DarkWake|Start)\s{2,}" finds the words in the 'domain' field of each line. It doesn't work with grep.

Another I use (which produces similar results) pmset -g log | grep -e "Wake from" -e "DarkWake" -e "due to" which finds the three phrases anywhere in each line of the log.
This is great!

Thank you, very much appreciated!
 

JoelBC

macrumors 65816
Original poster
Jun 16, 2012
1,026
86
One more clarification please, even though it may seem obvious.

I assume that "Sleep" means computer sleep (as opposed to Display Sleep which is presumably managed through "Display is turned off" and "Display is turned on").

Is this assumption correct and, if not, then what does "Sleep" refer o.

Thx.
 

gilby101

macrumors 68030
Mar 17, 2010
2,921
1,616
Tasmania
I assume that "Sleep" means computer sleep (as opposed to Display Sleep which is presumably managed through "Display is turned off" and "Display is turned on").
Yes, "Sleep" means computer sleep and not just display sleep. But the difficult question: what is computer sleep? There are certainly different sleep states. Note the my knowledge and experimentation is based on Intel Macs. There will be some differences for M1 Macs.

Your computer may stir in its sleep to do things caused by network activity, or to check for email, notifications and iCloud changes. "Power Nap" is a culprit - do you really need Time Machine backups to continue whilst the computer is not in use?

I have found web searches to produce different, often contradictory, descriptions of sleep states. Here is my list of sleeping states which is probably not complete and has one question mark:
  • Sleep - just the lid (on a laptop) closed. Screen off. RAM is still powered.
  • Safe Sleep - RAM has been written to disk (hence safe), but still powered.
  • Deep Idle - same as Safe Sleep?
  • Standby - RAM written to disk and RAM and USB powered off.
  • Hibernate - as standby, but everything powered off.
Note that except for hibernate, the Mac will 'Dark Wake' at intervals.

Missing from the above are: 1) a description of CPU sleep states (the CPU doesn't just turn off) and 2) network interface response whilst asleep.

The progress through sleep (in particular making the Mac get into deeper sleep) can be modified by changing sleep parameters with the pmset command. See my answer here https://apple.stackexchange.com/que...o-while-sleeping-all-night-long/423635#423635 where I includes steps I have taken to modify default sleep so as to reduce overnight battery drain. On Intel.
 

JoelBC

macrumors 65816
Original poster
Jun 16, 2012
1,026
86
Yes, "Sleep" means computer sleep and not just display sleep. But the difficult question: what is computer sleep? There are certainly different sleep states. Note the my knowledge and experimentation is based on Intel Macs. There will be some differences for M1 Macs.

Your computer may stir in its sleep to do things caused by network activity, or to check for email, notifications and iCloud changes. "Power Nap" is a culprit - do you really need Time Machine backups to continue whilst the computer is not in use?

I have found web searches to produce different, often contradictory, descriptions of sleep states. Here is my list of sleeping states which is probably not complete and has one question mark:
  • Sleep - just the lid (on a laptop) closed. Screen off. RAM is still powered.
  • Safe Sleep - RAM has been written to disk (hence safe), but still powered.
  • Deep Idle - same as Safe Sleep?
  • Standby - RAM written to disk and RAM and USB powered off.
  • Hibernate - as standby, but everything powered off.
Note that except for hibernate, the Mac will 'Dark Wake' at intervals.

Missing from the above are: 1) a description of CPU sleep states (the CPU doesn't just turn off) and 2) network interface response whilst asleep.

The progress through sleep (in particular making the Mac get into deeper sleep) can be modified by changing sleep parameters with the pmset command. See my answer here https://apple.stackexchange.com/que...o-while-sleeping-all-night-long/423635#423635 where I includes steps I have taken to modify default sleep so as to reduce overnight battery drain. On Intel.

Awesome and thank you.

This is very helpful as I am interested in setting up my laptop such that a) the display is off and b) the computer does not sleep (i.e. all is on except the screen).

With your above description it seems that all I need to do is make sure the Sleep Count = 0 which is easily tested through the pmset -g stats terminal command.

Worth noting, all the other commands provided above will be very useful when I want to dig deeper, which occurs frequently as I am curious about this.

Much thanks.
 
Register on MacRumors! This sidebar will go away, and you'll see fewer ads.