Flushing the Mac OS X DNS Cache

I was doing some website work this weekend which involved a DNS change to move a website to a new server. These DNS changes usually go pretty quick for me although I don’t usually change servers. In this case it had been over 24 hours and I was still getting the old site from my iMac. I did a DNS query and everything pointed to the new server. Since I use OpenDNS I was also able to verify what address their name servers had.

So finally I fired up another PC and went to the website. The new site loaded just fine. The old site kept coming up on my iMac so it was time to fiond out how to flush the local DNS cache without the pain of a reboot. The command to flush the cache is issued from terminal and is: dscacheutil -flushcache

Once I did that all was well.