Skip to content

Instantly share code, notes, and snippets.

@carlossless
Last active December 16, 2022 10:38
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save carlossless/3610ed6f466255aedc380109b2550a5c to your computer and use it in GitHub Desktop.
Save carlossless/3610ed6f466255aedc380109b2550a5c to your computer and use it in GitHub Desktop.
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