Make the display sleep


Issue: On my desktop Macs, I typically have the Energy Saver Preferences set to put the display to sleep after a specified amount of inactive time. For no obvious reason, the 24-inch Apple Cinema display attached to my Mac Mini running Snow Leopard (10.6.3) abruptly stopped going to sleep, ever.


Solution: I've described my trouble-shooting process chronologically here; for the impatient, scroll down to the bottom of this page for the solutions (especially see the 02/14/12 update for Lion).

Both the Shift-Control-Eject keyboard shortcut and setting a “Sleep Display” hot corner in the Mission Control (10.7) or Exposé (10.6, 10.5) System Preferences still work, so it's not a problem with the display sleeping process itself.

I tried setting various different idle times in the Energy Saver Preferences and waiting the specified time – no luck. (I should add that I have allowed “Wake for network access” and set the screen saver to “never”.)

I tried using pmset to set the sleep display idle time, and confirmed that this change was also reflected in the Energy Saver System Preferences panel; e.g.,

sudo pmset -a displaysleep 3

Still no luck. Next, I used the Plist Editor (start this by double-clicking on a .plist file in a Finder window – you must have Xcode installed for this to work) to examine the Energy Saver preferences; this file is located at

/Library/Preferences/SystemConfiguration/com.apple.PowerManagement.plist

I confirmed that the settings from the slider bar in the Energy Saver System Preferences panel were being stored correctly in the plist. Yep, they were. Finally, out of desperation, I deleted

/Library/Preferences/SystemConfiguration/com.apple.PowerManagement.plist

then logged out and back in. I then reset the Energy Saver preferences in the System Preferences panel from the defaults to my desired values (using a 1 minute display sleep time for testing). Voilà! It worked. I then set the display sleep time up to a more reasonable value (e.g., 30 minutes), and it continued to work.

By the way, if you are still using a screen saver on your LCD display (which I assume is because you just really like watching flying toasters, since a screen saver serves no purpose on a non-CRT display), then my subsequent googling of this problem suggests that sometimes the “display not sleeping” problem is accompanied by a similar “screen saver not starting” problem. In this case, the conventional wisdom is to delete

~/Library/Preferences/ByHost/com.apple.screensaver.*.plist

then log out and back in. There might be several corresponding plist files, for which the * represents a long identifying string of numbers and letters, either alone or with a specific screen saver name (e.g., “Cosmos”). I have not personally tried this (I find that the better solution to this problem is: don't use a screen saver), but have some confidence that it will work based on the similarity to the “display not sleeping” solution.

In fairness I should note that my googling also turned up some instances for which it is claimed that both of these solutions did not solve their respective problems. At the moment, I don't have any additional advice in that case – let me know if it happens to you.


UPDATE (08/12/11): So, this problem of the display not sleeping still happens to me every once in a while. I think it must be triggered by some software that is running on my computer, but I haven't managed to track down exactly what is causing it. However, I did find a nicer variant of the procedure for fixing it, that saves having to completely log out (thereby having to quit all running s/w, etc.):

1) Use System Preferences→Accounts to create a standard (i.e., not administrator) “dummy” account (e.g., you can literally name the account “dummy”, but do give it a good password).

2) In System Preferences→Accounts→Login Options, enable fast user switching, and turn off automatic login (but you already had that turned off, right?).

3) Instead of deleting the .plist file noted above, move it to your home directory:

sudo mv \
/Library/Preferences/SystemConfiguration/com.apple.PowerManagement.plist ~/

4) Now, use fast user switching to login to the dummy account without logging out of your normal user account.

5) Immediately log out (shift-Cmd-Q) from the dummy account (do not use fast user switching). This will return you to the OS X login screen.

6) Log back in to your normal user account (which is, technically, still logged in).

7) Finally, move the .plist file back to its original location:

sudo mv \ ~/com.apple.PowerManagement.plist /Library/Preferences/SystemConfiguration/

Your display should once again sleep after the desired interval of inactivity. Both of the sudo mv ... commands could be aliased to shortcut commands in your ~/.bashrc file (or equivalent).


UPDATE for Lion (02/14/12): So, the display-not-sleeping problem has now reared its ugly head under Lion. I tried the solution described above (which worked under Leopard and Snow Leopard) to no avail. I tried a few other things (e.g., manually deleting and re-creating the Energy Saver (i.e., Power Management) preferences file, logging completely out and back in, etc), stopping just short of rebooting the computer (which, in hindsight, probably would have resolved the issue). But read on...

The failure of the method described above to work in this case suggests two possibilities: (a) this procedure doesn't work under Lion, or (b) this procedure works under Lion for the same situations in which it works for Snow Leopard, but this wasn't one of those situations. Again, in hindsight, I think that (b) is more likely to be true. Here is how I resolved this issue with Lion:

The pmset command allows you to view and manipulate the OS X power management settings; for example, I show above how to use it to set the display sleep time. It can also be used to check the status of the power management settings and obtain some diagnostic information. The command

pmset -g

will return the power management settings currently in use. In my case, when the display would not sleep, this gave

Active Profiles:
AC Power-1*
Currently in use: 
hibernatemode0
disksleep10
womp1
networkoversleep0
sleep60
powerbutton0
ttyskeepawake1
hibernatefile/var/vm/sleepimage
autorestart1
panicrestart15
displaysleep0 (imposed by 54141)

The problem, obviously, stems from the displaysleep parameter being set to 0, which has, somewhat mysteriously, been “imposed by 54141”. The command

pmset -g assertions

which is only available in OS X 10.6 (Snow Leopard) or higher, sheds some light on this situation by revealing the list of power management rules that are governing the operating system. In my case, this gave:

Assertion status system-wide:
ChargeInhibit0
PreventUserIdleDisplaySleep1
PreventUserIdleSystemSleep0
NoRealPowerSources_debug0
CPUBoundAssertion0
EnableIdleSleep1
PreventSystemSleep0
DisableInflow0
DisableLowPowerBatteryWarnings0
ExternalMedia0

Listed by owning process:
pid 54141: [0x0000012c0000d37d] PreventUserIdleDisplaySleep named:
"Nameless (via IOPMAssertionCreate)"

{followed by a list of “Kernel Assertions”}

Again, obviously PreventUserIdleDisplaySleep 1 is the problem, but it is now clear that this condition is being enforced by a process with identification number (pid) 54141. Using

ps -ax | grep 54141

to list information about this process gave:

54141 ?? 3:17.46 /System/Library/CoreServices/RemoteManagement/
screensharingd.bundle/Contents/MacOS/screensharingd
68399 ttys001 0:00.00 grep 54141

So, the errant process appears to have been an old (compare its pid to the pid of the current grep process) Screen Sharing job that did not exit gracefully (as I did not currently have Screen Sharing running). Killing this process with

kill -9 54141

removed the unwanted power management assertion, and my display is sleeping again. Probably, rebooting the computer (which I stopped short of doing, as noted above) would also have fixed this problem by clearing out the bad process.

OS Version Compatibility: Lion, Snow Leopard, Leopard

Update Status: 14 February 2012