Flush / Reset DNS Cache in a Mac OS

You can use the below commands in the terminal to flush DNS / Reset DNS Cache on your macbook / Mac OS :

OS X Yosemite and later ( OS X v10.10.4 or later ):
sudo killall -HUP mDNSResponder

OS X v10.10 through v10.10.3:
sudo discoveryutil mdnsflushcache

OS X Mavericks, Mountain Lion, and Lion (OS X v10.9.5 and earlier):
sudo killall -HUP mDNSResponder

Mac OS X Snow Leopard (OS X v10.6 through v10.6.8):
sudo dscacheutil -flushcache