DNS request are usually cached, that’s good as it help to speeds up the lookups within the same host but sometimes we will want to clear the cache so it don’t hold the values that are no longer valid or we edited hosts file to block or redirect hosts or IP. To clear DNS cache in Mac OSX, we can do it with the help of Terminal.
Mac OSX 10.10
Open Terminal.app and type this command:
For older versions of OS X go here.
If you need to edit hosts file go here.