I built a customized Mac and was very happy with it, until I realized that it wouldn't automatically go to sleep regardless of my Energy Saver settings in System Preferences.
I did some research online and noticed that many people with real Macs were having similar issues (in my case it's because of the DVD drive), and then I found this site with a link to SleepWatcher; a very good utility!
Unfortunately, all the hints mentioned here either did not work for me, were incomplete, needed some other utility to work, or had an outdated method for launching.
So I've detailed the steps below to make it work system wide (and no it won't go to sleep if you're watching a movie) and hope it'll help those of you who have an insomniac Mac for whatever reason.
Note: this tip assumes that your system has no issue manually entering sleep and waking back up from it.
My Solution:
1 -- Install Homebrew. You need to have the Developer Tools installed to compile this.
Besides many other reasons to have Homebrew on your computer, it is one of the
easiest way to install command line software. Please use the default choices if the installation asks you to choose unless you know what you're doing. To install, copy and
paste the following into your Terminal and then press Enter:
ruby -e "$(curl -fsSLk https://gist.github.com/raw/323731/install_homebrew.rb)"
sudo brew install sleepwatcher
<?xml version="1.0" encoding="UTF-8"?> <!DOCTYPE plist PUBLIC "-//Apple Computer//DTD PLIST 1.0//EN" " http://www.apple.com/DTDs/PropertyList-1.0.dtd"> <plist version="1.0"> <dict> <key>Label</key> <string>com.cellar.sleepwatcher</string> <key>ProgramArguments</key> <array> <string>/usr/local/sbin/sleepwatcher</string> <string>-V</string> <string>-S /usr/local/sbin/sleepwatcher -d -t9000 -i "/usr/local/sbin/sleepwatcher -n" -p /tmp/sleepwatcherid</string> <string>-W kill `cat /tmp/sleepwatcherid`</string> </array> <key>RunAtLoad</key> <true/> <key>KeepAlive</key> <true/> </dict> </plist>
sudo -i cd /Library/LaunchDaemons chown root:wheel com.cellar.sleepwatcher.plist chmod 644 com.cellar.sleepwatcher.plist launchctl load com.cellar.sleepwatcher.plist logout
sudo launchctl list | grep sleepwatcher
sudo -i brew uninstall sleepwatcher launchctl unload /Library/LaunchDaemons/com.cellar.sleepwatcher.plist rm -f /Library/LaunchDaemons/com.cellar.sleepwatcher.plist cd `brew --prefix` rm -rf Cellar brew prune rm -rf Library .git .gitignore bin/brew README.md share/man/man1/brew rm -rf ~/Library/Caches/Homebrew logout
Mac OS X Hints
http://hints.macworld.com/article.php?story=20101130192909425