How to reset (flush) the DNS cache in OS X Yosemite

This is a simple guide describes how to reset DNS cache in Mac OS X Yosemite. Mac OS X always keeps a local cache of resolved DNS queries (IP address). But sometimes it may be necessary to clear / flush the cache. )t will refresh the data.
When you need to do this?
For example if you hit lot of 404 server error code, you may want to flush your DNS cache.
How to flush the DNS cache
This is a simple step. So you don’t need to worry about this thing.
OS X 10.10 Yosemite
Open Terminal and type the following command. It will clear MDNS & UDNS caches.
You can get the Terminal app in /Applications/Utilities/ Or use Spotlight for launch.
Flush the MDNS Cache

sudo discoveryutil mdnsflushcache

Press return and enter the admin password when required.
Reset the UDNS Cache

sudo discoveryutil udnsflushcaches

Again hit press and enter the admin password when required.
How to Reset and flush all DNS caches in OS X Yosemite
Use both two command together to remove DNS caches.

sudo discoveryutil mdnsflushcache;sudo discoveryutil udnsflushcaches;say flushed

How to check the DNS cache details in Mac OS X Yosemite
Use the following command in Terminal to get cache details.
Find UDNS cache statistics:

sudo discoveryutil udnscachestats

Get UDNS cache statistics:

sudo discoveryutil mdnscachestats

How to know the change? 
use dig command with url like this.


If you have any other issues, do let us via command.

5:38 am

Leave a Reply