How do you run a script after a network interface comes up? Is there a way to run a script every time a network interface finishes coming up? Or, is there an equivilent answer to this Debian question on OSX?
The following works on Mac OS X 10.11.3 (El Capitan)

Create a file: networkchange.plist


&lt;?xml version=&quot;1.0&quot; encoding=&quot;UTF-8&quot;?&gt;
&lt;!DOCTYPE plist PUBLIC &quot;-//Apple Computer//DTD PLIST 1.0//EN&quot; \
  &quot;http://www.apple.com/DTDs/PropertyList-1.0.dtd&quot;&gt;
&lt;plist version=&quot;1.0&quot;&gt;
&lt;dict&gt;
  &lt;key&gt;Label&lt;/key&gt;
  &lt;string&gt;networkchange&lt;/string&gt;
  &lt;key&gt;LowPriorityIO&lt;/key&gt;
  &lt;true/&gt;
  &lt;key&gt;ProgramArguments&lt;/key&gt;
  &lt;array&gt;
    &lt;string&gt;/Users/Shared/bin/networkchange.sh&lt;/string&gt;
  &lt;/array&gt;
  &lt;key&gt;WatchPaths&lt;/key&gt;
  &lt;array&gt;
    &lt;string&gt;/etc/resolv.conf&lt;/string&gt;
    &lt;string&gt;/var/run/resolv.conf&lt;/string&gt;
    &lt;string&gt;/private/var/run/resolv.conf&lt;/string&gt;
  &lt;/array&gt;
  &lt;key&gt;RunAtLoad&lt;/key&gt;
  &lt;true/&gt;
&lt;/dict&gt;
&lt;/plist&gt;


Then, register by running the following commands in Terminal:

launchctl load networkchange.plist
launchctl start networkchange

Note that the script is run by the user registering the plist.