How to Flush Your 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.servers

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

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.

Comments

  1. Rebecca Lynn Swanstrom says:

    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?

    • 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.

Speak Your Mind