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 dnsmasqCopy 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.confAdd 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.confHave brew configure launchd to start dnsmasq now and restart it at startup.
sudo brew services start dnsmasqFinally, 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
.devdomains since Chrome 63. .localmay be in use by the Bonjour service (check by runningscutil --dns).