Saturday, August 9, 2025

command line – launchctl: Run script when network interface is added/comes up?

I’m looking to run a script when ‘bridge100’ interface is added with an IP. How is this accomplished?

I see this post to add the following, however I’m not sure how one understand that ‘bridge100’ was the interface added and also has an IP:

<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple Computer//DTD PLIST 1.0//EN" \
 "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
  <key>Label</key>
  <string>ifup.ddns</string>

  <key>LowPriorityIO</key>
  <true/>

  <key>ProgramArguments</key>
  <array>
    <string>/Users/Shared/bin/ddns-update.sh</string>
  </array>

  <key>WatchPaths</key>
  <array>
    <string>/etc/resolv.conf</string>
    <string>/Library/Preferences/SystemConfiguration/NetworkInterfaces.plist</string>
    <string>/Library/Preferences/SystemConfiguration/com.apple.airport.preferences.plist</string>
  </array>

  <key>RunAtLoad</key>
  <true/>
</dict>
</plist>

or a watch on:

/Library/Preferences/SystemConfiguration/com.apple.airport.preferences.plist

Related Articles

LEAVE A REPLY

Please enter your comment!
Please enter your name here

Latest Articles