Skip to content

Instantly share code, notes, and snippets.

@carlos8f
Forked from danmactough/dnsmasq.md
Created August 15, 2014 18:07
Show Gist options
  • Save carlos8f/25d54ca09e1e86db2861 to your computer and use it in GitHub Desktop.
Save carlos8f/25d54ca09e1e86db2861 to your computer and use it in GitHub Desktop.

Install Dnsmasq on OSX

This will allow any url having the non-existant TLD .dev to resolve to your locale machine.

Install dnsmasq and run as a service

$ brew update
$ brew install dnsmasq
# Follow the instructions...
$ cp /usr/local/opt/dnsmasq/dnsmasq.conf.example /usr/local/etc/dnsmasq.conf
$ sudo launchctl load /Library/LaunchDaemons/homebrew.mxcl.dnsmasq.plist

Configure dnsmasq

Somewhere in /usr/local/etc/dnsmasq.conf add the following:

address=/dev/127.0.0.1

Dnsmasq should automatically reload the configuration when it changes.

Configure OSX to use dnsmasq

  • make sure you have a directory for additional dns resolvers
$ sudo mkdir -p /etc/resolver
  • create the dev resolver
$ sudo sh -c 'echo "nameserver 127.0.0.1" > /etc/resolver/dev'

OSX should automatically load the resolver.

Test

ping this.is.a.test.server.dev
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment