DEV Community


Route all .dev URL's to

scottrobertson profile image Scott Robertson Originally published at on ・1 min read

If you're like me, you always forget to edit the /etc/hosts file when you want to view a local site.

To get around this, you can use the following script to route all your .dev urls to (or any other IP). So you could go to "" and that would load from

brew install dnsmasq
mkdir -pv $(brew --prefix)/etc/
echo 'address=/.dev/' > $(brew --prefix)/etc/dnsmasq.conf
sudo cp -v $(brew --prefix dnsmasq)/homebrew.mxcl.dnsmasq.plist /Library/LaunchDaemons
sudo launchctl load -w /Library/LaunchDaemons/homebrew.mxcl.dnsmasq.plist
sudo mkdir -v /etc/resolver
sudo bash -c 'echo "nameserver" > /etc/resolver/dev'

Enter fullscreen mode Exit fullscreen mode

If you wish to use another IP, only change the first, otherwise it will look for a name server on the host.

Discussion (0)

Editor guide