How To Clear DNS Cache In Mac OSX 10.9 Mavericks

How To Clear DNS Cache In Mac OSX 10.9 Mavericks

by -
10

DNS request are usually cached, that’s good as it help to speeds up the lookups within the same host but sometimes we will want to clear the cache so it don’t hold the values that are no longer valid or we edited hosts file to block or redirect hosts or IP. To clear DNS cache in Mac OSX, we can do it with the help of Terminal.

Mac OS X 10.9 Mavericks System Compatibility List 300x225 How To Clear DNS Cache In Mac OSX 10.9 Mavericks

Mac OSX 10.9

Open up the application called “Terminal”

Type this command:

dscacheutil -flushcache

To reload DNS type this command:

sudo killall -HUP mDNSResponder

 

 

For older versions of OS X go here.

 

For new OS X 10.10 Yosemite go here.

 

digital ocean How To Clear DNS Cache In Mac OSX 10.9 Mavericks

 

 

 

If you need to edit hosts file go here.

 

10 COMMENTS

  1. Hello,

    When I do the command, for example,

    dig http://www.google-analytics.com

    I get the response:

    http://www.google-analytics.com. 71217 IN CNAME www-google-analytics.l.google.com.
    www-google-analytics.l.google.com. 156 IN A 201.17.31.88

    The number 156 means that this entry still has 156 seconds of live in the cache.

    When I do the command mencioned in your article, to flush the cache, and do the dig again, the number does not start to count again….

    If the cache was flushed, it wasn’t suppose to start to count from 300 again???

    Kind regards,
    Vicenzo

  2. No You are wrong. This TTL is from DNS server and not from your mac. Every DNS server is having set their own TTL usually 300 seconds.

    Try this command to get your DNS cache list “sudo dscacheutil -cachedump”, but it was reported by many users that this command is not always working on Mavericks.

  3. Is there any other way to flush dns? When Terminal asks for my password it doesn’t accept my keychain admin password.

  4. Are you typing correct password? You need admin password of your mac. For sudo commands you need admin rights.

    You can try with Onyx app it`s having option to clear DNS cache (Cleaning > Internet > Delete: DNS Cache).

  5. I used my admin password with no result: old page came up after repeated tries. And just now got this on attempting to open page: HTTP Status 500: org.apache.tiles.impl.CannotRenderException: JSPException including path ‘head.jsp’.with a screen full of code. I also tried the Onyx leaning option. I tested the site on another computer and it works fine.
    Thanks for your response!

    • I used Onyx again, and this time in the cleaning, I added the “bash” file to the list of checked items. It worked. Don’t have any idea what the bash file is, but the word appeared at the top of the terminal window, so I gave it a shot.

Leave a Reply