Quick Tip: Clear DNS Cache in Mac OS X

Mar 24, 2007 - 11 Comments

Anytime you visit a website or do any other kind of DNS lookup, the IP address conveniently gets cached. Well what’s convenient for most of us can be a real nuisance for others, particularly administrators who are moving around servers. Here’s a quick tip that Systems Administrators (and others) will surely appreciate. To clear the DNS cache in Mac OS X, at the Terminal type the following:
lookupd -flushcache

in Mac OS X Leopard and later, use this instead:
dscacheutil -flushcache

Enjoy this tip? Subscribe to the OSXDaily newsletter to get more of our great Apple tips, tricks, and important news delivered to your inbox! Enter your email address below:

Related articles:

Posted by: OSXDaily in Command Line, Mac OS X, Tips & Tricks


» Comments RSS Feed

  1. hmills says:

    I don’t think I’ve come across an instance where I would need this, but good to know

  2. […] Rychlý tip: čištění dns cache lookupd -flushcache zdroj: os x daily  […]

  3. Dave says:

    unfortunately no longer in leopard…. :-/

  4. adh says:

    dscacheutil replaces lookupd in leopard. So it just becomes dscacheutil -flushcachel

  5. David says:

    Example situation where it might make sense :
    Your office server has a domain name (mycompany.com), but the company’s ISP decides to change the IP address associated with your office’s internet connection. For a short while (may be as short as 2 hours, but as long as 2 or more days), all DNS requests for mycompany.com will still resolve to the old IP address (because of caches), thus making the new address totally unreachable by DNS name.

    If you clear your local DNS caches, it might then resolve to the new address.

    That is unless your ISP doesn’t cache itself the DNS results. In that case, your last resort is to modify your /etc/hosts file to manually override the IP address associated with “mycompany.com”.

  6. Gil Bates says:

    hmills, I happen to use this every day, multiple times a day.

    I do web development work and I have a local web server running on my laptop. I have an automator script which swaps my hosts file to point to the “real” site or my local development site with one click. At the end of the script, I clear the DNS cache. That way I can switch back and forth.

  7. Liviu Voicu says:

    Hello every one,

    I’m having an annoying problem since 3 days, I can not connect to any google domain and a few others (yahoo), using Leopard…
    I ran dscacheutil -flushcachel and it didn’t help :-(
    Could anyone help me please?


  8. […] vyčistit DNS cache, můžete tak učinit pomocí následujícího příkazu (dle vašeho OS): Tiger: lookupd -flushcache Leopard: dscacheutil […]

  9. Vincent says:

    i run dscacheutil -flushcache.. it gives me a “command not found” error

    i also tried lookupd -flushcache, “command not found”

    i did th whese while running in DVD OS X Leopard.

  10. Cameron says:

    Also have this problem. . and also no idea how to fix it. .

  11. dave says:

    The IP got changed on a site I was working with and I tried the command dscacheutil -flushcache it seemed to work but the DNS did not flush. I still cant view the site.

Leave a Reply


Shop for Apple & Mac Deals on Amazon.com

Subscribe to OSXDaily

Subscribe to RSS Subscribe to Twitter Feed Follow on Facebook Subscribe to eMail Updates