How to clear OS X DNS cache

og

You may occasionally get into a situation where the DNS on your Mac needs to be flushed from the system in order for a new server or some other DNS address change.

A DNS cache contains entries that translate Internet domain names *such as “compnetworking.about.com”) to IP addresses. The Internet’s Domain Name System (DNS) involves caching on both Internet DNS servers and on the client computers that contact DNS servers. These caches provide an efficient way for DNS to efficiently keep the Internet synchronized as the IP addresses of some servers change and as new servers come online.

OS X Yosemite have “new systems” to manage DNS which is

  1. MDNS Cache (Multicast DNS)
  2. UDNS Cache (Unicast DNS)

This post show how we clear the cache. Open the terminal and run this command

Clear MDNS Cache

sudo discoveryutil mdnsflushcache

Hit return and enter the admin password when requested.

Clear UDNS Cache

sudo discoveryutil udnsflushcaches

Again, hit return and enter the admin password when requested.

Flush and Reset All DNS Caches

sudo discoveryutil mdnsflushcache;sudo discoveryutil udnsflushcaches;say flushed

UPDATE: 

If your Mac is on 10.10.4, you need to use this command

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

Leave a Reply

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