- 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
It was reserved there as:
But it do not requires it to be defined as such. I am on Mojave 10.14.6 (18G1012) and this is not available:
If I setup the
dnsmasq
though it will work.