Steps extracted from this guide. To see how to set up DNSmasq on Ubuntu, see this guide.
First update brew and install dnsmasq:
brew update
brew install dnsmasq
Copy dnsmasq's example configuration. If brew
's installation process outputs different
commands to set a default configuration, use them instead.
cp /usr/local/opt/dnsmasq/dnsmasq.conf.example /usr/local/etc/dnsmasq.conf
Add the following to dnsmasq's config:
rules="
# resolve all .app and .test domains to Homestead:
address=/app/192.168.10.10
address=/test/192.168.10.10
"
cat "$rules" >> /usr/local/etc/dnsmasq.conf
Have brew configure launchd
to start dnsmasq now and restart it at startup.
sudo brew services start dnsmasq
Finally, tell your system to use your local DNS server for .app and .test domains:
sudo mkdir -p /etc/resolver
sudo bash -c "echo nameserver 127.0.0.1 > /etc/resolver/app"
sudo bash -c "echo nameserver 127.0.0.1 > /etc/resolver/test"
Other domains may fail for different reasons:
- Chrome forces using HTTPS for
.dev
domains since Chrome 63. .local
may be in use by the Bonjour service (check by runningscutil --dns
).