First, install dnsmasq using brew:
$ brew update
$ brew install dnsmasq
Then create your configuration
$ echo "address=/localhost/127.0.0.1" > /usr/local/etc/dnsmasq.conf
Now add it to your start up items:
$ sudo cp -fv /usr/local/opt/dnsmasq/*.plist /Library/LaunchDaemons
And launch it:
$ sudo launchctl load /Library/LaunchDaemons/homebrew.mxcl.dnsmasq.plist
Next tell OSX to use it:
Go to System Preferences -> Network -> Advanced -> DNS. Now remember the dns server you already have and add two entries: 127.0.0.1
and your former dns server. -> OK -> Apply.
And you're good to go!
Very very helpful. Thanks!