Skip to content

Instantly share code, notes, and snippets.

@lancehudson
Forked from oko/os-x-local-dnsmasq.sh
Last active August 29, 2015 14:17
Show Gist options
  • Save lancehudson/db66a64f72845667784a to your computer and use it in GitHub Desktop.
Save lancehudson/db66a64f72845667784a to your computer and use it in GitHub Desktop.
#!/bin/bash
brew install dnsmasq
cp /usr/local/opt/dnsmasq/dnsmasq.conf.example /usr/local/etc/dnsmasq.conf
sudo cp -fv /usr/local/opt/dnsmasq/*.plist /Library/LaunchDaemons
sudo chown root /Library/LaunchDaemons/homebrew.mxcl.dnsmasq.plist
echo -n "nameserver 127.0.0.1" | sudo tee /etc/resolver/dev
echo -n "nameserver 127.0.0.1" | sudo tee /etc/resolver/test
echo -n "nameserver 127.0.0.1" | sudo tee /etc/resolver/docker
echo "address=/dev/127.0.0.1" | sudo tee -a /usr/local/etc/dnsmasq.conf
echo "address=/test/127.0.0.1" | sudo tee -a /usr/local/etc/dnsmasq.conf
echo "address=/docker/192.168.59.103" | sudo tee -a /usr/local/etc/dnsmasq.conf
sudo launchctl load /Library/LaunchDaemons/homebrew.mxcl.dnsmasq.plist
sudo kill -9 $(pgrep dnsmasq)
sleep 1
dig +short @localhost domain.dev
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment