#!/bin/sh # This script must be run as root and sets up Mac OS X to route all .dev domains to the virtual box VM with the name # 'boot2docker-vm'. It does the following: # 1) Adds a file under /etc/resolver/dev # 2) Sets up a LaunchAgent for adding entries to the route table to route all requests to the Docker subnet (172.17.0.0/16) # And expects the $IFNAME variable to contain the interface on which to send traffic to the boot2docker VM. mkdir -p /etc/resolver echo "nameserver 172.17.42.1" > /etc/resolver/dev DIR=$(dirname "$0") USER=`w -h | sort -u -t' ' -k1,1 | awk '{print $1}'` /bin/rm -rf /Library/LaunchAgents/com.kitematic.route.plist echo " Label com.kitematic.route ProgramArguments /sbin/route -n add -net 172.17.0.0 -netmask 255.255.0.0 -iface $IFNAME 255.255.0.0 -gateway $GATEWAY KeepAlive RunAtLoad LaunchOnlyOnce " > /Library/LaunchAgents/com.kitematic.route.plist # Add entries to routing table for Kitematic VM /sbin/route delete -net 172.17.0.0 -netmask 255.255.0.0 -gateway $GATEWAY /sbin/route -n add -net 172.17.0.0 -netmask 255.255.0.0 -iface $IFNAME -gateway $GATEWAY