How to clear DNS cache on a mac running OSX

Clearing the cache on Mac’s seems to change with every other release these days. In all cases though you need to use Terminal, but not always the same command. Back in the 10.4 days you would use lookupd, then in 10.5 and 10.6 you would use dscacheutil, but now in 10.7 you need to now use a killall command.

Clear the DNS cache in 10.4:

sudo lookupd -flushcache

Clear the DNS cache in 10.5 and 10.6:

sudo dscacheutil -flushcache

Clear the DNS cache in 10.7:

sudo killall -HUP mDNSResponder

In any case, I’ve started to use a clearDNS.sh file in my bin directory these days with the correct command in it. Just so I do not need to always lookup how to clear the DNS cache on my laptop when I upgrade my OS.

Leave a Reply

Your email address will not be published. Required fields are marked *