Flush DNS Cache on Mac OS X

When you enter a web address into your webrowser like “geekwithenvy.com”, the DNS (Domain Name System) changes that user-friendly name into an IP address that computers can more easily understand. Your computer doesn’t need to do this every single time you visit a website because it stores the IP addresses for many sites on your computer for a short period of time. This information is stored in what’s called the DNS cache.representations of servers to show Clear DNS Cache

Unfortunately, this stored information may become corrupt or just end up being incorrect due to changes that occur on the site’s server. If your DNS cache has incorrect IP information then you won’t be able to access the site your trying to get to because it’s looking for the website in the wrong place.

There is a quick solution to correcting your DNS cache issues and that is to force it to ask the DNS what the new IP information is. You can do this by clearing the DNS cache or “Flushing” your DNS cache.

Launch Terminal and enter the commands below to flush your DNS Cache:

Mac OS X Lion and Mountain Lion (10.7 /10.8)

  • sudo killall -HUP mDNSResponder

Mac OS X (10.5 and 10.6)

  • dscacheutil -flushcache

If you happen to be running OS X Mavericks (10.9) you will want to do this two step command:

  • dscacheutil -flushcache;sudo killall -HUP mDNSResponder

Mac OS X Yosemite (10.10) 

 (Please note: The the following command will clear your DNS Cache but there is no official confirmation from the terminal when entered.

  • sudo discoveryutil mdnsflushcache
  • sudo discoveryutil udnsflushcaches

Mac OS X Yosemite (10.10.4 and Up) use this instead:

  • dscacheutil -flushcache;sudo killall -HUP mDNSResponder

That should cover it for DNS cache issues. If you are still having problems you can always reboot your machine, this should resolve any DNS inaccuracies on your computer.



  1. Rebecca Lynn Swanstrom

    Could you explain this in laymen’s terms? I have a MacBook Pro and I have a virus on my computer called the Centurylink.net redirect virus. From what I am reading, it looks like it Hijacked my DNS. I need to know how to reset the DNS; however, when I put the commands you provide in, nothing happens. It just keeps on taking me back to the same prompt. What am I doing wrong?

    1. Rich

      It may be flushing the DNS cache but the virus (hijack) may be undoing it. Haven’t run across this virus before. If all else fails you may want to search Apple’s support community ( discussions.apple.com) , if you can’t find your specific topic then start a thread. You should find help there.

  2. Brian Christopher

    I have OS X Yosemite, and I have tried to flush the dns, I type in the command, and press return, nothing happens.

    I am concerned about dns cache poisoning, but not being able to flush the DNS cache is highly frustrating.

    1. Rich

      Post Has been updated to include Yosemite. 🙂

  3. Tim

    Does Apple intentionally change the command to flush DNS on every major release? Is there any way to permanently disable the DNS cache? The Internet Gods have built DNS servers very capable of handling the caching…


Leave a Comment

Your email address will not be published.