macosdnsreset

Reset DNS Cache on Mac


I recently switched hosting services for my domain, and as I've been checking up on it recently, I've noticed that the changes have finished propagating, but my laptop (Mac OS X Mountain Lion, if that helps) still navigates to the old server when I type in the URL.

If I navigate to the page on any other device, it takes me to the new server. How can I reset my laptop's DNS cache? It happens in every browser, as well as displaying the old IP when I ping the domain from Terminal.

Could this have anything to do with my Wi-fi? My other devices are connected to the same network and are not experiencing the same problem.


Solution

  • dscacheutil -flushcache is what you are looking for. There is a manual page on developer.apple.com that describes its usage.

    I think that sending a hangup to mDNSResponder is the new solution to flushing the cache though - sudo killall -HUP mDNSResponder should do the trick.

    Note This probably should have been asked on http://apple.stackexchange.com instead.