Skip to content

Instantly share code, notes, and snippets.

@oliveira-andre
Last active March 26, 2025 08:45
Show Gist options
  • Save oliveira-andre/be022deec59c7a2ed5aaac786ff3348b to your computer and use it in GitHub Desktop.
Save oliveira-andre/be022deec59c7a2ed5aaac786ff3348b to your computer and use it in GitHub Desktop.
how to enable wake on lan in mac os and linux to power on your pc by alexa

MAC OS

  • open system preferences
  • open energy saver
  • click on power adapter
  • enable the wake for wi-fi network

this should work only on sleep of mac

Linux

  • install ethtool
sudo apt-get install ethtool -y
  • get mac address and interface
ip a
  • this must show error
sudo ethtool -s INTERFACE wol g
  • install wake on lan
sudo apt-get install wakeonlan -y
  • send magic package to enable wake on lan
wakeonlan MAC
  • create wol service
sudo vim /etc/systemd/system/wol.service
  • configure wol service
[Unit]
Description=Configure Wake On LAN

[Service]
Type=oneshot
ExecStart=/sbin/ethtool -s INTERFACE wol g

[Install]
WantedBy=basic.target
  • reload daemon
sudo systemctl daemon-reload
  • enable and start the wol.service
sudo systemctl enable wol.service; sudo systemctl start wol.service
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment