Waking up a NAS from Mac OS X at boot time using Wake-on-LAN (WOL)

Please see this post for a more recent version which works in OS X 10.11 El Capitan and newer.

Do you own a Wake-on-LAN (WOL) capable NAS (network attached storage) unit? Is your computer a Mac? Want to save on your energy bill?

The consumer NAS units you can buy these days are actually small Linux computers with a software RAID and a bunch of S-ATA hard drives inside. Depending on the make and model, some NAS units consume a considerable amount of energy even in standby mode. For instance, my QNAP NAS still consumes around 25W after all disks spun down. However, once I shut my NAS down, it only consumes 1W in deep sleep mode. It just keeps its network adapter barely alive so it’s able to “hear” a Wake-on-LAN signal.

I’m using my QNAP NAS primarily for backup purposes with Time Machine and SuperDuper. I usually don’t need my NAS on power hungry standby all day and night when I’m not at my Mac. So I thought it would be nice if the NAS could be woken from deep sleep whenever I’m starting my Mac. I then could use the internal scheduler in the NAS’s configuration interface to shut it down at predefined times (i.e. shutdown at 10 p.m. on weekdays).

I found some source code for a command line Wake-on-LAN tool and created a new x86_64 binary using Apple Xcode. To automatically start this WOL command line tool at boot time I needed a new “LaunchDaemon”.

com.trick77.wol.plist LaunchDaemon configuration

<?xml version="1.0"
encoding="UTF-8"?><!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN"
"http://www.apple.com/DTDs/PropertyList-1.0.dtd"><plist version="1.0">


. /etc/rc.common
while [ "${NETWORKUP}" != "-YES-" ]
  sleep 5
sleep 5
/usr/bin/wol 00:02:9C:C5:AD:31 #<-- Edit NAS MAC address here

What does naswake.sh do? It checks every 5 seconds if the network is up and once it is, it sends a Wake-on-LAN packet to the MAC-address indicated. The LaunchDaemon will spawn a new thread for naswake.sh so your Mac’s boot time won’t increase. If after 60 seconds still no network is up, naswake.sh will be terminated automatically by launchd.

Download and install NASwake

Check the download area on this site for an installable NASwake.pkg which contains all the files needed.

You have to edit naswake.sh and change the MAC-address to the address the LAN-adapter of your WOL-capable NAS is using. Usually, the MAC address can be found somewhere in the admin interface of the NAS unit. Once you installed the .pkg open Terminal and enter

sudo nano /usr/bin/naswake.sh

to edit the MAC address. Save and exit with ctrl-x.

How to uninstall NASwake

If you want to uninstall NASwake just open Terminal and enter

sudo rm /usr/bin/naswake.sh && sudo rm /usr/bin/wol && sudo rm /Library/LaunchDaemons/com.trick77.wol.plist


  • Did you enable Wake-on-LAN on your NAS?
  • Did you edit naswake.sh to insert the correct MAC address of your NAS as indicated above?
  • Does WOL work if you use WakeOnLan for Mac?
  • Are you using Mac OS X 10.6.5 or later?
  • Do you see any error messages in /var/log/system.log related to the com.trick77.wol LaunchDaemon?

Other WOL software for the Mac

Check out Readpixel’s great WakeOnLan software for the Mac. It discovers all other computers in your LAN, and enables you to wake them up by clicking a button. If your remote computer is a Mac you can put it asleep too.


Kudos go out to Jeff Kelley for providing a simple shell script to check the network state in a LaunchDaemon, Fred N. van Kempen and G. Knauf for the Wake-on-LAN tool source code.

9 replies on “Waking up a NAS from Mac OS X at boot time using Wake-on-LAN (WOL)”

  1. I think that El Capitan wiped the /usr/bin directory clean (of all third-party items). Also, /Library/LaunchAgents used to carry the trick77 plist and that, too, is missing.

    I’m pretty sure that reinstalling the .pkg should fix that. It’s just that you need your .sh script from a backup source (e.g. Time Machine) to reapply your NAS IP and everything.

  2. Does the latest version also runs on El Capitan? I just did a clean install and I miss it to get my NAS from standby to power via shortcuts. With 10.10 Yosemite everything worked perfectly.

  3. Wow!! awesome work!

    Is there anyway this can work when your macbook resume from sleep? I have managed to get this to work when i first boot up and log on, but not when resuming from sleep

    Thanks for the great work

  4. Since the readpixel website is gone, I wonder if you have the WakeOnLan widget from them?

  5. This is an amazing hint! Thank you so much for taking the time to provide a .pkg installer.

    BTW, doesn’t this merit publication in ‘MacUpdate’?

    With greetings from Athens,


  6. hello.. do you know how to auto shut down the NAS from the MAC when power failure? i have the backup power but it only send signal to the MAC

  7. Thanks for the shout-out! A quick note: looks like you’re missing a linebreak after CheckForNetwork in naswake.sh. Otherwise, looks like a great reason to use my script.

Comments are closed.