Possibly using a similar approach to [dnssnoop](https://github.com/lilydjwg/dnssnoop) on Linux. I'm not sure how to do this on Mac though.