The below steps are will do clear your DNS cache in your Operating system macOS X version 10.10.4 or above, have to follow the steps below, 

Note: When you run the command sudo killall -HUP mDNSResponder, enter the administrator account password.

1. Click Applications.
2. Click Utilities.
3. Click Terminal.
4. Run the following command:

sudo killall -HUP mDNSResponder

For macOS X version 10.10 through 10.10.3
 
sudo discoveryutil mdnsflushcache

For macOS X version 10.7, 10.8, or 10
 
sudo killall -HUP mDNSResponder

For macOS X version 10.5 or 10
 
sudo dscacheutil -flushcache