Mac not going to sleep after iTunes stops playing

Hardware/Software

  • MacBook Pro 17" 2009
  • Lion 10.7.3
  • iTunes 10.6

Issue

Unlike a lot of posts on the internet, my Mac actually goes to sleep just fine, usually.

However, if iTunes was playing something, and then I either explicitly stop it playing, or the movie/track/playlist comes to an end, it runs down the battery to zero!

I understand that iTunes doesn't let the Mac go to sleep if it's playing something, but if I explicitly press the stop/pause button, or the media stops playing, shouldn't the Mac go to sleep as per usual?

Anyway I can diagnose/fix this? is it a known issue?

cheers!


Check if really iTunes is causing this by opening a terminal and entering:

 pmset -g

If sleep is prevented by a process its ID is listed, like here:

 ...
 sleep      0 (imposed by 129)
 ...

Then check which process blocks going to sleep, in this example:

 ps -A | grep 129

   129 ??        37:39.06 /usr/sbin/coreaudiod

Then try killing (quitting) the process and check if you can send your computer to sleep, and if iTunes is still working. In this example it would be:

 sudo kill -3 129

Otherwise you could try re-installing iTunes, and/or repairing your file-premissions in Disk-Utility.