OS X Mountain Lion

In OS X Mountain Lion (10.8) and Lion (10.7) to clear the DNS cache you should run:

sudo killall -HUP mDNSResponder

And not the older command that worked in Leopard (10.5) and Snow Leopard (10.6):

sudo dscacheutil -flushcache