/etc/hosts
file is pretty useful for blocking websites (guide). Once you learn how to do it, it is also easy to unblock them.
Hosts cop will restore /etc/hosts
file to the previous version each time you try to remove blocked sites from it.
Adding sites to /etc/hosts
will not trigger a notification.
For macOS.
git clone https://github.com/agentcooper/hosts-cop
sudo ./hosts-cop/start
# from hosts-cop directory
sudo ./stop
Script needs to run from /Library/LaunchDaemons/
to be able to write to /etc/hosts
.