Clear Your DNS Cache

DNS is what finds Web sites when you are surfing. You type in a domain name, like MacMost.com and your ISP’s DNS server will figure out where that Web site is really located. But if that site has just moved, or if it was down recently, you may get an error instead. This error may persist even if the site if back up. This is because DNS information is cached on your Mac for quick access. So your Mac may have outdated DNS information.
To clear your DNS cache, open the Terminal application. In Leopard, type:
dscacheutil -flushcache
In earlier versions of Mac OS, use this instead:
lookupd -flushcache

Comments: 10 Responses to “Clear Your DNS Cache”

    J. R. Ransom
    14 years ago

    Great site and great videos. You are part of the new paradigm. Thanks. I have a 17" MacBook with OSX 1.6.2, 8 GB. I have a bunch of sites mostly Joomla portals. We moved them over the past several months from a server in One city to better servers in a city in another place. The DNS numbers were changed. My computer sometimes see the right DNS and sometimes it remembers the old DNS. I've tried "dscacheutil -flushcache" a zillions time but No Luck. Making me nuts. So I am thinking that this method doesn't solve everything. What to do? I'll keep trying. It happens with about 4 sites. Some we moved before are fine and some after, too. Very fexing. And my iPone right here with me shows the sites as being just fine. I'm not expecting an answer here. But I just wanted to mention this additional problem here.

      14 years ago

      It sounds like the bad DNS info might be coming from upstream. Have you thought about using a public DNS server on your Mac, like Google (http://code.google.com/speed/public-dns/docs/using.html) or OpenDNS? Then instead of getting your DNS information from upstream (your local ISP) you will get it from an independent source.
      At the very least you can test this out the next time you have trouble -- see if switching to Google DNS fixes the problem.

    Donna Brooks
    12 years ago

    Hi Gary. Is that Terminal command the same for Snow Leopard as for Leopard? Using the Terminal is the one thing I am least confident in doing. I would rather use a third-party app like OnyX or Ice Clean to do this since those are basically front ends for terminal commands.

    Do you have a video on managing browser cookies on this site? I sometimes go in and manually delete cookies that are obviously from sites I don't want (and I have turned off third party cookies), but so many cookies are not identifiable simply by looking at their name. Omniweb displays cookies while you are visiting a site, so you can see what cookies are installed, and can delete them easily, but, to my dismay, Omniweb constantly crashes on me in Tiger & Snow Leopard. I considered using this freeware for Safari: http://www.macupdate.com/app/mac/19784/cocoa-cookies but I've never used that one before. What do you recommend for managing cookies, esp. since I use Safari, Firefox, and Chromium all regularly? Is there somewhere on this site where you talk about this b/c I haven't found anything yet?

      12 years ago

      I have this episode about cookies: http://macmost.com/browser-cookies.html
      Why do you want to manually manage your browser cookies like that? For the most part, they are harmless. My recommendation would be to not waste much effort on worrying about them.

    Donna Brooks
    12 years ago

    First and foremost is for privacy. I'm concerned about a site putting spyware on my computer. I don't *want* advertisers placing targeted ads on webpages when I browse (although I've pretty much done away with that problem using AdBlock in Safari, FF, & Chromium). Another reason is that, rather than visiting a few sites often, I visit a huge number of different sites. Managing my bookmarks b/t browsers using Xmarks has been a nightmare (b/c of duplicates), but even once I ran the duplicate detector & deleted 4,000 dupes, I still had over 15,000 bookmarks. It seems to me that even snippets from all those sites, plus the ones I *don't* bookmark, add up eventually. Plus, even benign cookies, like any other bits of programming, can have errors that may affect my computer in negative ways. I don't spend a lot of time on them, but every once in a while I do look at them and just remove a few dozen that are obviously related to advertising or are from sites I don't want to remember me. I know cookies are important for sites I care about to recognize me. I don't want to delete those. Thanks for the link! I watched your vid. Maybe I'm just overly protective of my Mac. Still want to confirm that the Snow Leopard Terminal command for clearing the DNS cache is the same as in Leopard? I'm willing to try Terminal for that, as long as I'm absolutely sure I'm typing the correct command.

      12 years ago

      A few things: First, you can't get spyware through cookies. Second, turning off third-party cookies should be sufficient enough for a lot of the targeted ads. Though is that really a problem? How do you think ads are being targeted to you? Even if they are, would you rather get a completely random ad, or an ad that is an educated guess as to be something that you are interested in? Third, recognize that using ad blockers mean that you are cheating web sites. Sites like MacMost are ad supported. If you do not like the ads at a site, then maybe don't visit the site. Otherwise, you are taking the content, but cheating the site. DNS cache clearing should be the same in Lion.

    Donna Brooks
    12 years ago

    I'd rather NOT have targeted ads b/c they are much more likely to distract me than random ads. Distractions are not helpful if I want to get anything done that is actually on MY agenda. I don't mind cheating Facebook or other big sites. With smaller sites, don't you get paid just for the placement of the ad, (which is perhaps placed based on your site traffic)? Can advertisers tell if I am on a website but can't see their ad? If so, that sort of proves my point that they can tell what my activities are.

    The whole purpose of advertising is to control people, a profession I don't feel compelled to support. Websites have to do what advertisers want in order for the actual creators of the content to stay on-line to get their message out, while advertisers leech off content creators, both website owners and those posting (in varying degrees according to the website). Meanwhile, look at how quickly said advertisers have turned our relationship into an adversarial one! I just wrote a glowing recommendation of your podcast and website in the iTunes store less than a week ago,— something I've never bothered to do for the hundreds of podcasts I've checked out over the years,— and now I am intimidated to send a question to you that is sitting in my mail Drafts folder because I needed to come look up your email address.

    The onus of "buyer beware" should be on advertisers for a change, not their targets. In this complex world, with so many voices calling for our attention, time, and money, there is just too much for one person to "beware" of (scrutinize). Unfortunately, rather than relying on quality and satisfied customers to sell their products, many companies now rely on the sheer numbers of new prospects.

    Thanks for the info on the DNS cache. I had not even heard of it until seeing this vid.

      12 years ago

      You don't mind cheating big sites, but not small ones? I don't see the moral distinction. Is it OK to steal a car from a car dealer, but not an individual?
      Rarely do you get paid for ad placement anymore. Advertisers pay based on results.
      I don't feel my advertisers are "leeching" anything -- they are supporting the site. I love them. They make MacMost possible. They make many of my other favorite web sites possible. And TV shows, and newspapers/magazines, etc.
      Why not turn it around and feel thankful that advertisers are willing to support good content on the Internet?
      Keep in mind that advertisers can't track "you" as a person. They don't know who you are. They are merely tracking the aggregate "you." For instance they could target people that visit tech sites with more tech-related ads. But they don't have a record with your name on it.
      Think of it like a department store. When you walk in the door, they don't know your name. But if you linger in a certain section for a while, a salesman might approach and ask if you need help. They still don't know your name, they just approach anyone who lingers in that section.

    Arlene Shaw
    12 years ago

    Somehow the 'clear cache' option has disappeared. I tried entering the command recommended above (lookupd -flushcache) and got the response 'command not found'. How do I recover the clear cache option in the Safari menu?

Comments Closed.