**Update Sept 6, 2009: **I’ve created a project at github to simplify this process. More details here.

Task: You want to use Time Machine wirelessly to backup your Mac to a drive on another Mac on your network.

Problem: If the target machine is in “sleep” mode, your backup will fail.

Solution: Send a “magic packet” to the target machine to wake it up if it’s sleeping.

Gotcha: New Macs support WOL via Airport. However if you’re using an older Mac, the target machine must be connected via ethernet (the machine you’re backing up can still be connected via wifi).

Let’s roll:

Prep the Target Machine

The target machine is the Mac that will hold your backups.

  1. On the target machine, go to System Preferences and open the “Energy Saver” panel.

  2. Configure sleep settings as desired

  3. Be sure to check the “Wake for Ethernet network access” box at the bottom.

  4. Close out of system preferences.

  5. Open System Profiler from your Utilities directory in Applications.

  6. Click “Network” in the left panel.

  7. Click “Ethernet” in the top panel.

  8. In the bottom panel, scroll down until you see “Ethernet:” with a line under it showing something like “MAC Address 00:15:d4:a3:cf:1b”. Write down this 12-digit MAC address.

  9. Exit System Profiler

Configure the Host Machine

The host machine is the Mac that you will be backing up.

  1. On the host machine, install MacPorts if you haven’t already.

  2. Open up a Terminal from your Utilities directory in Applications.

  3. Type: “sudo port install wakeonlan” and press return.

  4. Enter your password when prompted, and wait while MacPorts installs the utility and its dependencies.

  5. Open Automator in Applications.

  6. Create a new “Application” workflow when prompted.

  7. Double-click the “Run Shell Script” library item on the left. In the box that appears, erase “cat” and instead type:

    macaddress="00:00:00:00:00:00"
    while true
    do
     	   results=`syslog -k Sender com.apple.backupd -k Time gt -10s -k Message Seq 'Starting standard backup'`
     	   if [ -n "$results" ]
     	   then
     		   /opt/local/bin/wakeonlan "$macaddress"
     		   while [ -n "$results" ]
     		   do
     			   sleep 10
     			   results=`syslog -k Sender com.apple.backupd -k Time gt -10s -k Message Seq 'Starting standard backup'`
     		   done
     	   fi
     	   sleep 10
    done
    
  8. In the first line, replace the 00:00:00:00:00:00 with the MAC Address that you wrote down earlier. Be sure to keep the quotes.

  9. Choose File > Save As…, and name it “WOL Daemon” in the Applications folder when prompted.

  10. Exit Automator.

  11. Go to System Preferences and open the “Accounts” panel.

  12. Click “Login Items” at the top.

  13. Click the + icon to add a new one.

  14. Select the WOL Daemon that you just created, and check the box next to it marked “Hide”.

  15. Restart your computer, and voilà, your target machine will now be woken up if it’s asleep while Time Machine runs.