3

I block some websites via /etc/hosts on my machine. But for reddit.com it does not work. What does I have to do?

##
# Host Database
#
# localhost is used to configure the loopback interface
# when the system is booting.  Do not change this entry.
##
127.0.0.1   localhost
255.255.255.255 broadcasthost
::1             localhost 
127.0.0.1 mackeeperapp.mackeeper.com
127.0.0.1 mackeeperapp2.mackeeper.com
127.0.0.1 mackeeperapp3.mackeeper.com
127.0.0.1 mackeeper.com
127.0.0.1 reddit.com
  • What do you mean by not working - typing reddit.com into safari shows reddit? – Mark Jun 4 '16 at 14:28
1

I found this on GitHub but I haven't tried it.

# Simply curl -s this and pipe it into sh.
# This script uses root privileges, be careful!
# Appends a list of known Reddit subdomains to your /etc/hosts file, and points them to localhost.
# Should work totally fine, but I take no responsibility if it messes up your machine.

# **Made by Colby Ludwig** (twitter.com/cdl)

sudo bash -c "echo -e '\n\n# -- Block all of Reddit --\n127.0.0.1\t\treddit.com\n127.0.0.1\t\twww.reddit.com\n127.0.0.1\t\tnp.reddit.com\n127.0.0.1\t\tssl.reddit.com\n127.0.0.1\t\tblog.reddit.com\n127.0.0.1\t\tfr.reddit.com\n127.0.0.1\t\tpay.reddit.com\n127.0.0.1\t\tes.reddit.com\n127.0.0.1\t\tenus.reddit.com\n127.0.0.1\t\ten.reddit.com\n127.0.0.1\t\tru.reddit.com\n127.0.0.1\t\tus.reddit.com\n127.0.0.1\t\tde.reddit.com\n127.0.0.1\t\tdd.reddit.com\n127.0.0.1\t\tno.reddit.com\n127.0.0.1\t\tpt.reddit.com\n127.0.0.1\t\tww.reddit.com\n127.0.0.1\t\tss.reddit.com\n127.0.0.1\t\t4x.reddit.com\n127.0.0.1\t\tsv.reddit.com\n127.0.0.1\t\tnl.reddit.com\n127.0.0.1\t\thw.reddit.com\n127.0.0.1\t\thr.reddit.com' >> /etc/hosts"
1

Safari keeps its own ephemeral DNS cache. If you've just added the record to /etc/hosts, try quitting Safari, running dscacheutil -flushcache and restarting the computer.

You must log in to answer this question.

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