Clear your DNS cache in OS X - Mon, Jan 25, 2016
Sometimes you need a quick way of clearing your DNS cache - for example when developing sites and adding hostnames to /private/etc/hosts
A quick way of clearing the cache is:
dscacheutil -flushcache; sudo killall -HUP mDNSResponder
I’ve set it up in my ~/.bashrc as such: alias killdns=“dscacheutil -flushcache; sudo killall -HUP mDNSResponder” That way I can easily just run “killdns” and my cache will be clear.