Apple's Snow Leopard operating system introduced Wake On Demand (WoD). This is an open standard, intended to be a more user-friendly version of Wake On LAN (WoL) which has been around for years.
Wake On Demand allows computers to save energy by sleeping when idle, whilst waking up automatically if another machine on your network requests service. So for example, your iMac can save energy by sleeping, but it will wake up quickly if you need to copy a file over to your MacBook; access an iTunes library; or log in remotely via Remote Desktop or SSH. The Wake On Demand feature is enabled by ticking the box marked Wake for network access under System Preferences / Energy Saver. Sensibly, laptops don't wake up with lid closed or without mains power.
Whilst the Wake On Demand feature is well-intentioned, it has an unwelcome side-effect: the sleeping computers wake up every two hours (day and night) to check the local network configuration and refresh the Bonjour proxy cache. I don't like this: it's a waste of energy (the computer won't sleep again until the usual timer expires); it unnecessarily stresses the machine; and it's annoying if someone's sleeping in the same room as the computer.
The Wake On Demand feature depends on a device on your network running a Bonjour Proxy Cache server. Recent firmware for the Apple Time Capsule and Apple Airport Express wireless access points implement a Bonjour Proxy service. I've already blogged about one side-effect of this here: Apple Time Capsule steals IP addresses, but that's OK really. An always-on Mac can also run the Bonjour Proxy service (e.g. if Internet connection sharing is enabled).
Wake on LAN is an open standard that predates Wake-on-Demand. To wake up a computer using WoL, you just need to send a "magic WoL packet" to the computer's Ethernet MAC address.
Annoyingly, the Snow Leopard OS doesn't offer any way to enable WoL without enabling WoD. However, there is a workaround documented in an article at the link below:-
- 10.6: Turn off automatic wake-from-sleep network check [hints.macworld.com]
"A comment in mDNSResponder's open source code offers some explanation:As an alternative to Sleepwatcher, you might try disabling Bonjour advertisements [Apple.com] if you don't mind not being able to resolve the hostnames of any machines on your local network that don't have DNS entries. (Non-geeks: don't try this at home unless you have your own DNS nameserver, or you only have one computer on your network at any time.)
we still want to wake up in at most 120 minutes, to see if the network environment has changed. E.g. we might wake up and find no wireless network because the base station got rebooted just at that moment, and if that happens we don't want to just give up and go back to sleep and never try again....So how do I turn off this auto-wake feature then?
The code in mDNSResponder makes only two checks on when not to schedule the maintenance wakes:
This check is always made at the point the machine is about to go to sleep. After much experimentation, I finally have a reliable way of defeating this check without really doing either of the above.
- If 'Wake for network access' is turned off
- if there are no Bonjour-advertised services on your system
Using sleepwatcher, add the following commands to your script to run when your computer is going to sleep:
/bin/sleep 1 /usr/sbin/systemsetup -setwakeonnetworkaccess on >/dev/nullAnd add this to your 'wakeup' script:
/usr/sbin/systemsetup -setwakeonnetworkaccess off >/dev/nullFinally, also execute that last command right now, or just manually turn 'Wake for network access' off in the Energy Saver preferences.
What this does is turn wake for network access on only at the very last moment when your machine is going to sleep. This way, mDNSResponder will be fooled into thinking you don't have network wakes enabled, so it won't schedule the unwanted maintenance wake. In reality, though, your sleep script will enable it anyway, but in such a way that mDNSResponder doesn't see it."
If you use the Ports (formerly Fink) framework, you can install Sleepwatcher using one command:-
sudo port install sleepwatcher
Then just follow the instructions. I placed the commands from the Macworld article into the files /opt/local/etc/rc.sleep and /opt/local/etc/rc.wakeup. But by default those scripts allow for per-user sleep and wakeup commands.
You might also find these links useful:-
- bb's Homepage [Sleepwatcher]
- pmset command [Wikipedia.org]
- pmset(1) Mac OS X Manual Page [developer.apple.com]
- Sleep Proxy Service [Wikipedia.org]
- Mac OS X v10.6: About Wake on Demand [support.apple.com]
Sending the magic Wake-On-LAN packet
You can probably wake up every box on a LAN segment by sending the magic WoL packet to the broadcast MAC address (all FF's) but I've never tried that.
PS... If the Mac won't go to sleep (or stay asleep), do you have a Canon USB scanner plugged in? I've got a Canon LiDE 500F scanner, bought from the Apple web store, but the drivers are awful and they stop the Mac from sleeping. Unplugging the scanner and rebooting solves the problem. It's a pity Apple didn't test the scanner before selling it in their web store. Recommendations gratefully received for an affordable USB scanner with really decent OS X support.
ReplyDeleteMost USB and FireWire scanners are supported by Vuescan, an awsome Mac scanning application. I would go with HP or Epson.
ReplyDeleteDoes the Mac support Wake on LAN from a shutdown or hibernated machine? I can only get mine to work from sleep.
ReplyDeleteHi Ryan. No, not as far as I can tell. There's no setting for that in the GUI, nor is there any mention in "man pmset".
ReplyDeletecan I ask you this - you say you use Airport express - i do to, but not as my main router, just as a client. i get intermittent successes trying to use the WoD feature (and I don't want to use AEX as my router as i have a great one).
ReplyDeletewhat do I need to open in my router (ports etc) to make it work, currently it doesn't work (macs do not wake up)?
Hi. Thought you were talking about Wake On LAN :-
Deletehttp://en.wikipedia.org/wiki/Wake-on-LAN
(- No specific port, it actually triggers based on the content inside an ethernet frame addressed to your target MAC)
but perhaps you're talking about Wake On Demand (Apple) :-
http://support.apple.com/kb/ht3774
(- That one's all about Bonjour Sleep Proxies)
Either way, you should be able to wake up your Macs if they connect via Ethernet (and the right settings are set in Preferences). But Wakeup over Wireless networks only works in some very recent Macs, and I've not used it myself.
Hope this helps
Just reading your question again. If WoD isn't working locally, then you need something that's capable of acting as a bonjour sleep proxy. So you'd need an Apple device of some sort, unless other manufacturer's Bonjour-aware devices now provide this service. It's not simply a question of opening up a port on a router - unless you're talking about sending a WoL packet from a remote network.
Delete