0

macOS layman here,

I'm trying to block websites natively with mixed results through Terminal using sudo nano /etc/hosts

My syntax is

127.0.0.1 www.website.org
::1 www.website.org

I've tried various iterations, with space, with tab, but there's a pesky little website that I can't manage to block.

eg. I've blocked lichess.org but haven't managed yet to block 4chan.org. I've searched the web but I didn't get any wiser. I don't understand how I can block one site with exactly the same syntax but I can't block another.

macOS Big Sur Version 11.2.3 (20D91) / Safari Version 14.0.3

Ideally I would like to do this on the back end without using Screen Time or Parental Control. Any help is appreciated.

EDIT:

127.0.0.1       www.4chan.org
127.0.0.1       4chan.org
127.0.0.1       https://www.4chan.org
127.0.0.1       https://4chan.org

127.0.0.1       https://boards.4channel.org
127.0.0.1       https://boards.4chan.org


::1             www.4chan.org
::1             4chan.org
::1             https://www.4chan.org
::1             https://4chan.org

::1             https://boards.4channel.org
::1             https://boards.4chan.org
3
  • Can you add the specific line(s) you use to block 4chan.org? – nohillside Mar 23 at 14:19
  • Added the lines on the original post. – Alex Mar 24 at 0:12
  • hosts is for DNS, you can‘t add URLs in there (well, you can, but it will not work) – nohillside Mar 24 at 6:53
2

The hosts that are not being blocked successfully are probably already in your DNS cache.

Try clearing the cache using:

sudo dscacheutil -flushcache; sudo killall -HUP mDNSResponder

if you are on Big Sur (looks like you are), or:

sudo killall -HUP mDNSResponder

if you are running Catalina, Mojave, High Sierra, or Sierra.

You may also need to clear the browser cache. For Safari, go to Safari -> Preferences -> Advanced and turn on "Show Develop menu in menu bar". Next, in the Develop menu, chose "Empty Caches"

1
  • I've tried this and it didn't help. – Alex Mar 24 at 0:06

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .