macOS – Wake Up Servers Using Wake-on-LAN ( WOL ) Command Utility

I know how to send WOL command using Linux or FreeBSD wake command. But, how do I send Wake on LAN (WOL) frames to hosts on a local Ethernet network using Apple OS X Unix operating systems to wake up my servers or nas devices?

Tutorial details
Difficulty Easy (rss)
Root privileges No
Requirements brew and perl
Time 2m
You need to use the wakeonlan Perl script that generates and transmits a Wake-On-LAN (WOL) “Magic Packet”, used for restarting machines that have been soft powered-down (ACPI D3-warm state).

macOS – Wake Up servers and computers using Perl script

We need to install wakeonlan Perl script.

Method #1: Install wakeonlan using Homebrew

First, install Homebrew on macOS. For instance:
curl -O https://raw.githubusercontent.com/Homebrew/install/master/install.sh
bash install.sh

Open the Terminal app and then type the following command to install wakeonlan client on your Mac:

brew install wakeonlan

Sample outputs:

Fig.01: OS X brew install wakeonlan client

Method #2: Download and install wakeonlan Perl script

Open a terminal and type the following curl command:
$ mkdir -p $HOME/bin
$ curl https://raw.githubusercontent.com/jpoliv/wakeonlan/master/wakeonlan -o ~/bin/wakeonlan
$ chmod +x ~/bin/wakeonlan

How do I send WOL on a macOS or OS X?

The syntax is:
$ ~/bin/wakeonlan server-mac-address-here
For example, if nas01 server has 00:08:9b:c4:30:30 mac address, enter:
$ ~/bin/wakeonlan 00:08:9b:c4:30:30
Sample outputs:
Sending magic packet to 255.255.255.255:9 with 00:08:9b:c4:30:30

Other options

    -i ip_address
        set the destination IP address
        default: 255.255.255.255 (the limited broadcast address)
    -p port
        set the destination port
        default: 9 (the discard port)
    -f file 
        uses file as a source of hardware addresses

Apple computer wake for network access (WOL) setting

If you want other users to be able to access your Apple OS X based computer’s shared resources, such as shared printers/files/folders or iTunes playlists, even when your computer is in sleep mode. Open System Preferences > choose “Energy Saver preferences“. This set options that control your computer’s energy use including WOL for all Mac Based server and client systems:

Fig.01: OS X setting WOL

On the latest version of macOS look for Battery option under System Perfecnces on your MacBook pro or MacBook air > Power Adapter:

Make sure you select the option “Wake for network access” so that other users can wake up your Mac computer using WOL magic packet.

Summing up

We can send ‘magic packets’ to wake-on-lan enabled ethernet adapters, in order to switch on the called PC or server. We can also wake up sleeping Mac mini or MacBook pro for backups and any other reasons.


🐧 Get the latest tutorials on Linux, Open Source & DevOps via RSS feed or Weekly email newsletter.

🐧 4 comments so far... add one

CategoryList of Unix and Linux commands
File Managementcat
FirewallAlpine Awall CentOS 8 OpenSUSE RHEL 8 Ubuntu 16.04 Ubuntu 18.04 Ubuntu 20.04
Network Utilitiesdig host ip nmap
OpenVPNCentOS 7 CentOS 8 Debian 10 Debian 8/9 Ubuntu 18.04 Ubuntu 20.04
Package Managerapk apt
Processes Managementbg chroot cron disown fg jobs killall kill pidof pstree pwdx time
Searchinggrep whereis which
User Informationgroups id lastcomm last lid/libuser-lid logname members users whoami who w
WireGuard VPNAlpine CentOS 8 Debian 10 Firewall Ubuntu 20.04
4 comments… add one
  • meow Jun 10, 2013 @ 14:45

    Or you can just install brew or macports to have wol

  • Simon May 30, 2014 @ 10:07

    Well that was easy, thank you!

    Using to WOL HP Proliant DL380

  • ManT Nov 24, 2014 @ 9:31

    I was under the assumption that wake-up / power-on is not possible when a Mac machine has been “powered-off” or “hibernated”. It is only possible to wake-up a Mac machine from “Sleep”.

    This got me interested but somehow the link for the utility provided on this page is not working: http://gsd.di.uminho.pt/jpo/software/wakeonlan/downloads/wakeonlan-0.41.tar.gz

    Can someone provide me the right link?

    thanks in advance.

  • Erik Jan 18, 2015 @ 12:23

    It looks like this has been moved to Github: https://github.com/jpoliv/wakeonlan

    There’s also a brew formula for this new, so if you have Homebrew you can just do “brew install wakeonlan”

Leave a Reply

Your email address will not be published.

Use HTML <pre>...</pre> for code samples. Problem posting comment? Email me @ webmaster@cyberciti.biz