This works on Mojave but likely works on some of the newer versions of OSX as well. Just run the below command in your terminal of choice:

sudo killall -HUP mDNSResponder

sudo is required since mDNSResponder runs as a separate user.

This section of my site is just notes that don't require a full blog post. You can find all my full posts over here.