One Thing Well

A weblog about simple, useful software.

Follow on Twitter, Google+ or via the feed. Feel free to get in touch. Sponsor the site.

Automatically Reconnect to a VPN on OS X

For some reason, the built in VPN tool on OS X doesn’t reconnect if the connection drops. The following snippet of AppleScript will fix that:

on idle
    tell application "System Events"
        tell current location of network preferences
            set myConnection to the service "VPN NAME"
            if myConnection is not null then
                if current configuration of myConnection is not connected then
                    connect myConnection
                end if
            end if
        end tell
        return 120
    end tell
end idle

Plonk the above in AppleScript Editor (replacing VPN NAME with the Service Name you entered when configuring your VPN) and save it as an Application with the ‘Stay Open’ option checked.

Source: Ask Different