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 OS X 10.11 El Capitan
Open Terminal.app and type this command:
sudo dscacheutil -flushcache
Check How to Clear DNS Cache with discoveryutil in Mac OS X Yosemite
For older versions of OS X go here.
If you need to edit hosts file go here.