Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
Setup dnsmasq for .localhost domains on macOS

.localhost domains on macOS with dnsmasq

  1. Install dnsmasq
brew install dnsmasq
  1. Add an address entry to point everything under .dev to 127.0.0.1 in /usr/local/etc/dnsmasq.conf
echo "address=/.localhost/127.0.0.1" >> "$(brew --prefix)"/etc/dnsmasq.conf
  1. Start dnsmasq
sudo brew services start dnsmasq
  1. Create the resolver directory (if it doesn't already exist)
sudo mkdir -p /etc/resolver
  1. Create a new resolver configuration to point to the dnsmasq instance
echo "nameserver 127.0.0.1" | sudo tee /etc/resolver/localhost
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.