I have modified my
/etc/hosts file to block website.com and www.website.com.
I know the formatting of my hosts file is correct because when I restart Safari, the block takes effect. I can also enter into a private window, and the block takes effect. If I do not take any action, Safari will eventually start blocking the sites from my host file after about 5 minutes. Is therany wayay I can expedite this?
When I test in Chrome, there is no need to restart Chrome, my blocks immediately start working.
sudo killall -HUP mDNSResponder
sudo dscacheutil -flushcache
I've also read attempted all of the formatting suggestions on stack exchange for the etc/hosts file, but nothing seems to work. No matter what, Safari needs to be reset for the blocks to take place.
I would like for a solution that can be done programmatically (i.e. through a terminal command or some sort of script - not through some GUI application) so that I can package this in with my application.