- install dnsmasq
$ brew install dnsmasq
...
$ cp /usr/local/opt/dnsmasq/dnsmasq.conf.example /usr/local/etc/dnsmasq.conf
- edit
/usr/local/etc/dnsmasq.conf
address=/local/127.0.0.1
- start dnsmasq
$ sudo brew services start dnsmasq
- any time we change
dnsmasq.conf
we have to re-start dnsmasq:
$ sudo launchctl stop homebrew.mxcl.dnsmasq
$ sudo launchctl start homebrew.mxcl.dnsmasq
- For OS X to resolve requests from
*.local
to localhost we need to add a resolver:
$ sudo mkdir /etc/resolver
$ sudo touch /etc/resolver/local
- edit
/etc/resolver/local
nameserver 127.0.0.1
- re-start the computer to enable the resolver
=== REFERENCES
- Using Dnsmasq for local development on OS X - Passing Curiosity
- Using Dnsmasq Configure Wildcard DNS Record on Mac | Ri Xu Online
- unix - In my /etc/hosts/ file on Linux/OSX, how do I do a wildcard subdomain? - Server Fault
- hostname - Wildcard in /etc/hosts file - Unix & Linux Stack Exchange
- Mac OS Lion - Wildcard subdomain virtual host - Stack Overflow
- How to put wildcard entry into /etc/hosts? - Stack Overflow
@TheM1984 last time I have checked it didn't worked on my macOS Mojave, maybe in Catalina they changed it. For sure you do not need additional resolver on systemd enabled Linux, but Let's localhost be localhost RFC wasn't accepted and it is still not standardised solution.