PCs optimize

Remotely wake a sleeping Mac

Vincent Danen shares a simple script that you can use to remotely wake a sleeping Mac. Here's how to get it and configure it for your setup.

Vincent Danen shares a simple script that you can use to remotely wake a sleeping Mac. Here's how to get it and configure it for your setup.

----------------------------------------------------------------------------------------

With the price of computers being what they are, computers have taken on eccentric and eclectic roles in the home and office. With Mac mini's costing as little as $599, using a Mac computer as a media server or simple file server is inexpensive. For instance, with a little creative cabling, you can hook up a Mac mini to your HDMI TV instead of using an Apple TV. More expensive, sure, but with a wireless keyboard and mouse, all of a sudden you have a full entertainment solution connected to your TV rather than just an appliance to watch videos and listen to music.

The upside of such a setup is that with a larger hard drive, you can make the Mac mini host all of your iTunes media and connect to it via iTunes to listen to music, etc. The downside is that the computer would have to remain on 24/7 in case you wanted to connect to it, but this is hardly efficient for something that may not be used all that often.

Being able to put the computer to sleep would be much more efficient; however, the problem then becomes a question of how to wake it up remotely if you do want to access files or media stored on it.

Fortunately, with most Macs that are wired to the local network via Ethernet, this poses little problem. Unfortunately, for Macs connected to the network via wireless, this won't work as, when they go to sleep, so do the wireless antennas. For a wired Mac, however, waking it up remotely is simple.

The best tool for the job is the Wakeonlan perl script, which also works on more systems than just Macs. Running a perl script is very un-Mac-like, so a nice front-end for it called Wake550 is available.

Begin by downloading the .dmg file on the Web site. It is a PPC application, so you will need Rosetta installed to run it on an Intel Mac. The interface is very minimal; you will require a few bits of information for this to work: the broadcast IP of the local network and the hardware MAC address of the computer you wish to wake up.

This information can be retrieved on the remote Mac by launching the Network Preferences Pane, selecting the Ethernet connection, clicking Advanced, and then the Ethernet tab. The Ethernet ID is the hardware address you want. To obtain the broadcast ID, open the Terminal and launch the "ifconfig" utility:

ifconfig en0
en0: flags=8863<UP,BROADCAST,SMART,RUNNING,SIMPLEX,MULTICAST> mtu 1500
       inet6 fe80::217:f2ff:fe00:4064%en0 prefixlen 64 scopeid 0x4
       inet 192.168.250.50 netmask 0xfffffe00 broadcast 192.168.251.255
       ether 00:17:f3:00:4c:64
...

You can specify the interface to use (typically en0) and pass it as an argument to ifconfig, or don't specify an interface to get information on all interfaces. Incidentally, the hardware address is noted here as well. The output you are looking for is the broadcast address; in this case it is 192.168.251.255. Once you have this information from the remote Mac, you can use Wake550 to wake it up remotely.

There are also applications for the iPhone that can wake up a sleeping Mac as well, such as SleepOver or iWOL. Note that they have the same limitation that Wake550 and Wakeonlan do: they only work on systems with wired ethernet connections.

About

Vincent Danen works on the Red Hat Security Response Team and lives in Canada. He has been writing about and developing on Linux for over 10 years and is a veteran Mac user.

0 comments