Skip to content

Instantly share code, notes, and snippets.

@nfourtythree
Forked from r10r/enable_dnsmasq_on_osx.sh
Last active May 10, 2016 11:52
Show Gist options
  • Save nfourtythree/beed22bac1655fc5c2fffe5652911386 to your computer and use it in GitHub Desktop.
Save nfourtythree/beed22bac1655fc5c2fffe5652911386 to your computer and use it in GitHub Desktop.
Installs and configures dnsmasq on osx (for local resolution of development machines e.g virtualbox). Cudos to Alan Ivey http://www.echoditto.com/blog/never-touch-your-local-etchosts-file-os-x-again
# ----------------------
# installing dnsmasq and enable daemon
# ----------------------
brew install dnsmasq
sudo cp -v $(brew --prefix dnsmasq)/homebrew.mxcl.dnsmasq.plist /Library/LaunchDaemons
# ----------------------
# adding resolver for dev domain
# ----------------------
[ -d /etc/resolver ] || sudo mkdir -v /etc/resolver
sudo bash -c 'echo "nameserver 127.0.0.1" > /etc/resolver/dev'
# ----------------------
# configuring dnsmasq
# ----------------------
cat >> $(brew --prefix)/etc/dnsmasq.conf <<-EOF
address=/.dev/192.168.56.101
EOF
# ----------------------
# launching dnsmasq
# ----------------------
sudo launchctl load -w /Library/LaunchDaemons/homebrew.mxcl.dnsmasq.plist
# ----------------------
# restarting dnsmasq command
# sudo launchctl stop homebrew.mxcl.dnsmasq
# sudo launchctl start homebrew.mxcl.dnsmasq
# ----------------------
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment