How to flush the DNS cache with discoveryutil in OS X Yosemite

flush-dns-intro-image

It seems that the day is tightening and with 28 degrees in the shade in Las Palmas de Gran Canaria we are going to explain to you how to empty the DNS cache in case you have problems when resolving a certain IP against a domain. It is a small tutorial focused on advanced users since you have to use the OS X Terminal.

The first thing you have to know is that the way we had to do this action has changed with the advent of OS X Yosemite and that, as far as we know, will continue in this vein on OS X El Capitan which will be released in fall. In operating systems prior to OS X Yosemite, the process was done through mDNSResponder, but now it has been replaced by discoveryutil.

In OS X Yosemite, to proceed with flushing the DNS cache you have to use a combination of several commands in the OS X Terminal. Those commands will flush the MDNS cache (it is the Multicast) and the UDNS cache (the Unicast). Let's start with the process you have to do to clear the DNS cache:

We open the Terminal, for which we look for it in the Spotlight or go to Launchpad> OTHERS folder> Terminal. Once the Terminal is open, you will proceed to write the following commands:

sudo discoveryutil mdnsflushcache

y

sudo discoveryutil udnsflushcaches

clear-cache-dns

As you can see, they are two separate commands and each time we enter one we will be asked for the administrator password since they begin with sudo. Now, if you want to do the process with a single line of code, you should write it like this:

sudo discoveryutil mdnsflushcache;sudo discoveryutil udnsflushcaches;say flushed

For terminal the article we indicate that if before emptying the DNS cache you want to see the information that there is so much In Multicast as in Unicast you must use the following commands:

sudo discoveryutil mdnscachestats

or this one for Unicast:

sudo discoveryutil udnscachestats

If you want to do this on other OS X systems:

OS X Mavericks (10.9)

1
dscacheutil -flushcache; sudo killall -HUP mDNSResponder

OS X Mountain Lion (10.8)

1
sudo killall -HUP mDNSResponder

OSX Lion (10.7)

1
sudo killall -HUP mDNSResponder

OS X Snow Leopard (10.6)

1
sudo dscacheutil -flushcache

OS X Leopard (10.5)

1
sudo dscacheutil -flushcache

OSX Tiger (10.4)

1
lookupd -flushcache

Leave a Comment

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

*

*

  1. Responsible for the data: Miguel Ángel Gatón
  2. Purpose of the data: Control SPAM, comment management.
  3. Legitimation: Your consent
  4. Communication of the data: The data will not be communicated to third parties except by legal obligation.
  5. Data storage: Database hosted by Occentus Networks (EU)
  6. Rights: At any time you can limit, recover and delete your information.

      rafa said

    at 10.10.4 mdnsrespond returns

      shoulder said

    The same as Rafa in l1 10.10.4 he does not recognize the commands.