Flush DNS cache in Lion and Mountain Lion

Aug 08, '12 07:30:00AM

Contributed by: kirkmc

I came across this Apple technical note this morning, which describes how to flush the DNS cache on your Mac. We have a hint for 10.5, which is also valid for 10.6, but we're not up to date.

So, as a reminder, to flush the DNS cache in Mac OS X 10.5 and 10.6, run this command in Terminal:

sudo dscacheutil -flushcache 
To do the same in 10.7 and 10.8, run this command:
sudo killall -HUP mDNSResponder 
As Apple points out, you might need to do this in the following situation:

"OS X keeps a local cache of resolved DNS queries for a time defined by the DNS server, but sometimes it may be necessary to reset the cache immediately and re-query a DNS server. For example, you might do this after an entry on the server is changed or a new entry is added."

Comments (8)


Mac OS X Hints
http://hints.macworld.com/article.php?story=20120808001623238