How to Clear DNS Cache in Mac OS X Yosemite

So, you want to clear your OS X’s DNS cache but don’t know how and even dscacheutil isn’t getting the job done. That is possibly caused by you being on a different version of Mac’s operating system, most probably OS X Yosemite 10.10.

To clear DNS caches completely on OS X Yosemite (version 10.10.x), you will need to clear both MDNS (Multicast DNS) and UDNS (Unicast DNS) caches via Terminal. Here’s how you can get this done.

If you are looking for ways to clear cache for other versions of OS X (including the latest El Capitan), click here to skip to the last section on this post.

Method 1: Clear MDNS & UDNS caches Separately

Enter the following commands separately in your terminal.

The first will clear the MDNS cache and the second will clear the UDNS cache. You will require the admin password to perfom this task.

sudo discoveryutil mdnsflushcache
sudo discoveryutil udnsflushcaches

That’s all! Click here to read more about flushing DNS cache in OS X Yosemite.

Method 2: Clear MDNS & UDNS caches together

Alternatively, you can use the following command. Basically it’s the same, it combines both of the above into one.

sudo discoveryutil mdnsflushcache;sudo discoveryutil udnsflushcaches;say flushed

Clearing DNS Cache in other OS X

If you are not on OS X Yosemite, here is a recap of how to clear or flush dns cache in latest OS X El Capitan and other older versions of Mac.

OS X El Capitan (10.11)

sudo dscacheutil -flushcache; sudo killall -HUP mDNSResponder; say DNS cache flushed

OS X Mavericks (10.9)

dscacheutil -flushcache; sudo killall -HUP mDNSResponder

OS X Mountain Lion (10.8)

sudo killall -HUP mDNSResponder

OS X Lion (10.7)

sudo killall -HUP mDNSResponder

OS X Snow Leopard (10.6)

sudo dscacheutil -flushcache

OS X Leopard (10.5)

sudo dscacheutil -flushcache

OS X Tiger (10.4)

lookupd -flushcache