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.