Clear DNS cache on macOS
To clear your local DNS cache on macOS do the following:
dscacheutil -flushcache
sudo killall -HUP mDNSResponder
A simple wrapper for this (that might go in your bashrc) would be:
function clear_dns_cache() {
echo "Clearing local DNS cache..."
dscacheutil -flushcache
sudo killall -HUP mDNSResponder
}