I know there are lots of tutorial out there to setup and use Dnsmasq, but bare with me this is also for my own sake (so I don’t have to look on how to do it the next time I setup a computer from stratch).
First thing first you need to install Dnsmasq. You can do so using homebrew on mac:
brew install dnsmasq
Next you need to add a new config line for you custom domain or extension in the dnsmasq.conf config file (at the end of it).
# If you installed with brew the config lives here : /usr/local/etc/dnsmasq.conf # Add the following to the above file address=/.domain.net/127.0.0.1 #or any IP really # Note: You can also specify only the .tld without any domain prefixes
Last thing you need to do is tell your computer resolver to use Dnsmasq
# In /etc/resolver create a new file following the pattern of .domain.tld but removing the first ".". So in our example: domain.net # In domain.net add the following: nameserver 127.0.0.1
Now launch Dnsmasq as a service using brew.
brew services start dnsmasq