$ brew install dnsmasq
$ echo 'address=/.test/127.0.0.1' >> /opt/homebrew/etc/dnsmasq.conf
$ echo 'listen-address=127.0.0.1,192.168.1.2' >> /opt/homebrew/etc/dnsmasq.conf
note: - as dnsmasq configuration recommendation is to include 127.0.0.1 - 192.168.1.2 is ip of macos
$ sudo brew services start dnsmasq
$ Error: Failure while executing; /bin/launchctl bootstrap system /Library/LaunchDaemons/homebrew.mxcl.dnsmasq.plist
exited with 37.
$ sudo brew services restart dnsmasq
$ Successfully started dnsmasq
(label: homebrew.mxcl.dnsmasq)
$ sudo mkdir /etc/resolver $ sudo bash -c 'echo "nameserver 127.0.0.1" > /etc/resolver/test'
$ ping abcd.ef.test