To get your Mac to clear your DNS cache, then confirm it’s cleared your cache by echoing a confirmation, enter these two commands separated by a semi-colon as shown here: “ sudo killall -HUP mDNSResponder say DNS cache has been flushed“.Note: You will need to enter your admin password to execute this command. Now, type “ sudo killall -HUP mDNSResponder” and press Return.To flush the DNS cache on your Mac, open Terminal and use the following command (sudo enables you to run this command as the admin of your machine):.In most cases, the new mapping should work immediately, but if you’re not seeing the correct behavior, you may need to flush your DNS cache, forcing the browser to read from your hosts file to determine the mapping. With the modified hosts file now in place, fire up your Web browser to test the changes. Choose Replace and then enter your administrative user password to authenticate the transfer.
When you drop the hosts file back in its original location, macOS will ask you what to do about the unmodified hosts file that’s already there.