speed up launchctl execution I've set up a bunch of scripts that need to happen when I connect my thunderbolt dock at home (disable wifi, enable bluetooth, ...).

To detect the thunderbolt dock I make use of the following launchctl service:

&lt;?xml version="1.0" encoding="UTF-8"?&gt;                                                                   
&lt;!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd"&gt;
&lt;plist version="1.0"&gt;
&lt;dict&gt;
    &lt;key&gt;Label&lt;/key&gt;
    &lt;string&gt;romeovs.dock.agent&lt;/string&gt;
    &lt;key&gt;ProgramArguments&lt;/key&gt;
    &lt;array&gt;
        &lt;string&gt;/Users/romeovs/.bin/dock/run.sh&lt;/string&gt;
    &lt;/array&gt;
    &lt;key&gt;RunAtLoad&lt;/key&gt;
    &lt;true/&gt;
    &lt;key&gt;LaunchEvents&lt;/key&gt;
    &lt;dict&gt;
        &lt;key&gt;com.apple.notifyd.matching&lt;/key&gt;
        &lt;dict&gt;
            &lt;key&gt;com.apple.system.config.network_change&lt;/key&gt;
            &lt;dict&gt;
                &lt;key&gt;Notification&lt;/key&gt;
                &lt;string&gt;com.apple.system.config.network_change&lt;/string&gt;
            &lt;/dict&gt;
        &lt;/dict&gt;
    &lt;/dict&gt;
&lt;/dict&gt;
&lt;/plist&gt;


This service listens to launchd for a network change to happen (detecting the wired network that is connected to the dock). This setup seems to work but it is really slow to detect and act when the dock is connected.

It already takes a long time for the dock network to be set up, but after that it also takes another 5 seconds before the script actually gets called.

Is there a way to make the service detect the network changes any faster (without setting up a polling service)?
The delay is most likely to be within the notification centre; the notifyd service is not time critical.

Consider using a process observing IOKit level notifications. At the IOKit layer notifications are immediately dispatched and designed for processes reacting to hardware changes.

Trying using Growl and the HardwareGrowler addition to trigger your script.