Mac OS X 10.8 flush DNS cache

I came across this Apple specific DNS cache situation this morning.
I changed a DNS record for my GIT-server and was trying to access it again, the DNS was still showing the old IP-Address. After some attempts to clear Linux DNS cache with “rndc flush” I recognized that dns is was cached by my Mac.

Mac OS X keeps a local cache of successful resolved DNS queries for a time defined by the DNS server.

To clean DNS Cache in Mac OS X versions 10.7 and 10.8, run this command from your Terminal: