23rd May 2012

Flush DNS Cache on MAC OS X

Mac OS X – Clearing or flushing the DNS Cache

Once you go to a Web site, or do any DNS lookup, the IP gets cached for quite a while. This becomes a royal pain if youíre a systems administrator who is in the middle of migrating domains from one server to another. Executing the following clears the cache, restarts the caching daemon, and fetches fresh DNS records. And there was much rejoicingÖ

For Leopard


sudo dscacheutil -flushcache

For Tiger

lookupd -flushcache

(On Windows you do ipconfig /flushdns)

This post is copyright of Thropos Ltd ©2008-2011 at Etherealmind.com - contact | email: greg.ferro@packetpushers.net - twitter: @etherealmind | All rights reserved
About Greg Ferro

Greg Ferro is a Network Engineer/Architect, mostly focussed on Data Centre, Security Infrastructure, and recently Virtualization. He has over 20 years in IT, in wide range of employers working as a freelance consultant including Finance, Service Providers and Online Companies. He is CCIE#6920 and has a few ideas about the world, but not enough to really count.

He is a host on the Packet Pushers Podcast, blogger at EtherealMind.com and on Twitter @etherealmind and Google Plus

  • http://systems.takizo.com takizo

    Thanks dude. Was looking how to flush DNS on my snow leopard, it’s the same command as Leopard.

  • http://etherealmind.com Greg Ferro

    Use your account password that you use when you login

  • http://etherealmind.com Greg Ferro

    Configure your client / workstation to use a DNS server on the Internet such as the Google DNS server at 8.8.8.8 and 8.8.4.4 and you won’t have that problem.

  • Lee

    I had the same problem. And then it doesn’t allow me to type in my password. What do I do?

    • http://etherealmind.com Greg Ferro

      Make sure you type “sudo” at the front.

      • Lee

        I did. Otherwise it wouldn’t show password at all. The problem is I can’t type in any numbers following “Password:”

        • Christopher Giroir

          This is standard unix. Just type your password and hit enter. It won’t show you typing at all. This is to keep others from guessing anything about your password from looking, like asterisks online or in other programs.

  • Harold

    When i type sudo dscacheutil -flushcache it says unknown. it doesnt ask for my password. what am i doing wrong?

  • Pingback: Tutorial: Cum sa faci downgrade de la iOS 5 la iOS 4.3.3

  • Rmp2011

    In Snow leopard:

    I tried above suggestion from within my daily user account, typed in my admin password and got “Sorry, try again.” (retried to make sure no typo).When I typed in the USER account’s password I got “USER is not in the sudoers file. This incident will be reported.”Do I have to do this from within the Admin’s account, and will that clear that the DNS cache from other User’s accounts?(and who will I be reported to ( : >).Thanks for your excellent advice!