Terminal will NOT block any sites. HELP.

Joined
Sep 6, 2010
Messages
7
Reaction score
0
Points
1
I have followed the instructions posted on countless sites, countless times to block two simple websites.
I have done it over and over.
Not once has it worked for me.
I have flushed the cache in Terminal and Safari.
I have restarted my computer.
I have done everything other than pull my hair out trying to get this to work.

Help.

I am running Snow Leopard. 10.6.4 on a Macbook.
 

cwa107


Retired Staff
Joined
Dec 20, 2006
Messages
27,042
Reaction score
812
Points
113
Location
Lake Mary, Florida
Your Mac's Specs
14" MacBook Pro M1 Pro, 16GB RAM, 1TB SSD
Which instructions did you follow (so that we don't duplicate efforts)?
 
OP
L
Joined
Sep 6, 2010
Messages
7
Reaction score
0
Points
1
The first thing we need to do is launch the Terminal application so we can work on the command line. To do this, navigate to and open the 'Applications' folder that is on your hard drive. Then scroll down and open the 'Utilities' folder that is contained within the 'Applications' folder. Run the Terminal application by double clicking its icon.

You should now have a new Terminal window open. Make sure it's selected so that you see the word 'Terminal' in the top left menu of your
desktop.
2
Before making any changes to system files it's always good practice to make a backup of the original file. Do that now by typing the following command in Terminal

sudo /bin/cp /etc/hosts /etc/hosts.backup

Hit 'Enter' and type in your password
3
Now that we have a backup of the original file, we can change the original by typing the following command in Terminal

sudo /usr/bin/pico /etc/hosts

Hit 'Enter' and type in your password
4
The command you ran above opens up the 'hosts' file in a text editing program called pico. Do not change any of the original text; instead, we will add text at the end of the file.

To move your cursor (the small rectangle in the window) to the end of the file, hold down the 'Control' key on your keyboard and then hit 'v' so they're both pressed at the same time. Hit 'Enter' a couple of times to give yourself some room to type.
5
In the next few steps, you will need to swap 'BLOCKEDSITE.COM' with the site you want to block.

Type in the following text but with the site you want to block

127.0.0.1 WWW.BLOCKEDSITE.COM
127.0.0.1 BLOCKEDSITE.COM

Now close and save the file by holding down the 'Control' key and pressing the 'x' key at the same time. Then type in the 'y' key and finally hit the 'Enter' key.
6
Now quit your web browser to clear its cache. Open the browser again and navigate to WWW.BLOCKEDSITE.COM or BLOCKEDSITE.COM. Unless you have your own computer setup to serve web pages, the browser will now complain that 'the Browser can't connect to the server'.

That's because we have configured the computer to redirect any browser request for BLOCKEDSITE.COM to your own computer. You might choose to setup your computer to serve a web page with an appropriate message such as 'Access Blocked'.

From ehow.com

All the websites say the same thing. I am just unable to get it to work, no matter what I do.
 

cwa107


Retired Staff
Joined
Dec 20, 2006
Messages
27,042
Reaction score
812
Points
113
Location
Lake Mary, Florida
Your Mac's Specs
14" MacBook Pro M1 Pro, 16GB RAM, 1TB SSD
Yep, that's pretty much what I would have told you to do.

The HOSTS file is basically the first place your computer goes to resolve DNS names to IP addresses. In theory, redirecting a web address to the IP 127.0.0.1, should steer it back to our own computer, causing it to fail.

So, if you open up terminal and type:

Code:
sudo /usr/bin/pico /etc/hosts

Do you see your blocked sites listed? Note that the syntax is very important, it should be:

127.0.0.1 www.unwantedsite.com

At each line below the commented out lines (those that start with a #).
 
OP
L
Joined
Sep 6, 2010
Messages
7
Reaction score
0
Points
1
I can see the sites that should be blocked.
It's all as it should be.
 

cwa107


Retired Staff
Joined
Dec 20, 2006
Messages
27,042
Reaction score
812
Points
113
Location
Lake Mary, Florida
Your Mac's Specs
14" MacBook Pro M1 Pro, 16GB RAM, 1TB SSD
What's the address of the unwanted site?
 
OP
L
Joined
Sep 6, 2010
Messages
7
Reaction score
0
Points
1
Formspring

There are two specific Formspring sites I am trying to block.
They do not end in .com is that a problem ?
Or should it be working ?
 

cwa107


Retired Staff
Joined
Dec 20, 2006
Messages
27,042
Reaction score
812
Points
113
Location
Lake Mary, Florida
Your Mac's Specs
14" MacBook Pro M1 Pro, 16GB RAM, 1TB SSD
Formspring

There are two specific Formspring sites I am trying to block.
They do not end in .com is that a problem ?
Or should it be working ?

What do they end in, and did you list them exactly as the URL is spelled out?
 

cwa107


Retired Staff
Joined
Dec 20, 2006
Messages
27,042
Reaction score
812
Points
113
Location
Lake Mary, Florida
Your Mac's Specs
14" MacBook Pro M1 Pro, 16GB RAM, 1TB SSD
Another thought. Try using 0.0.0.0 instead of 127.0.0.1
 

cwa107


Retired Staff
Joined
Dec 20, 2006
Messages
27,042
Reaction score
812
Points
113
Location
Lake Mary, Florida
Your Mac's Specs
14" MacBook Pro M1 Pro, 16GB RAM, 1TB SSD
OK, that's why...

You can only block the domain name from the HOSTS file (formspring.me), which would block the site completely. I take it you want to block specific pages under that domain? If that's the case, you're going to need a more sophisticated solution. I'd have to research that a bit.
 

dtravis7


Retired Staff
Joined
Jan 4, 2005
Messages
30,133
Reaction score
703
Points
113
Location
Modesto, Ca.
Your Mac's Specs
MacMini M-1 MacOS Monterey, iMac 2010 27"Quad I7 , MBPLate2011, iPad Pro10.5", iPhoneSE
CWA is correct. I tried it here and even putting http at the beginning made it not work. (www.formspring.me) though did block the entire site. The Syntax of the command is very critical.

I tried a few other solutions like Pithelmet but they seem really for blocking content on a site like ads and pics.
 
OP
L
Joined
Sep 6, 2010
Messages
7
Reaction score
0
Points
1
Oh, thankyou. I didn't even think of that, I was so focussed on blocking specific profiles I didn't even stop to consider the site itself.

Thank you for your help, I really appreciate you taking the time :)
 

Shop Amazon


Shop for your Apple, Mac, iPhone and other computer products on Amazon.
We are a participant in the Amazon Services LLC Associates Program, an affiliate program designed to provide a means for us to earn fees by linking to Amazon and affiliated sites.
Top