Looks like no one’s replied in a while. To start the conversation again, simply ask a new question.

Blocking websites in Safari

Hi, I've been wanting to block a certain website so my friends can't use it on my computer, and I'm running into trouble when using the Terminal method.

I type in sudo pico /etc/hosts, my password, and then 127.0.0.1 http://www.website

and then I've tried ctrl o, which tells me it's written the file (saved?), I exit out of the terminal, and open Safari and the website isn't blocked. Am I missing a step? When I hit ctrl o it gives me the file name /etc/hosts -- do I need to change that?

Mac Book Pro, Mac OS X (10.5.7), Safari Version 3.2.3

Posted on Aug 13, 2009 12:27 PM

Reply
Question marked as Best reply

Posted on Aug 13, 2009 1:23 PM

Greetings,

The Hosts file is just a text file located in the /etc directory that you can edit with any text editor; no need to use Terminal and Pico to do it. Did you enter 0.0.0.0 domainname.com, and then save the changes? Did you reboot your Mac before you tried it in Safari? Be sure to do that.

If you don't want to manage Hosts using a text editor or with Pico, you can also use Hostal, which is only $9.99.
11 replies
Question marked as Best reply

Aug 13, 2009 1:23 PM in response to gillylinus

Greetings,

The Hosts file is just a text file located in the /etc directory that you can edit with any text editor; no need to use Terminal and Pico to do it. Did you enter 0.0.0.0 domainname.com, and then save the changes? Did you reboot your Mac before you tried it in Safari? Be sure to do that.

If you don't want to manage Hosts using a text editor or with Pico, you can also use Hostal, which is only $9.99.

Nov 22, 2009 6:02 AM in response to Omar.KN

Hi
I was just trying to do the same thing, i.e blocking access to a specific website.
I looked a the/etc/hosts file which reads

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
fe80::1%lo0 localhost


Do I just need to add on a new line as mentioned before,
0.0.0.0 domainname.com
and save it.
or do I need the http://

I have also in the /etc folder these files
hostconfig
hostconfig~
hosts.equiv

Which I am not sure what they are for

Many thanks

Nov 22, 2009 7:49 AM in response to lune

Hi--

lune wrote:
Do I just need to add on a new line as mentioned before,
0.0.0.0 domainname.com
and save it.
or do I need the http://


Definitely don't use the "http://" part. That would make it not work.

I have also in the /etc folder these files
hostconfig
hostconfig~
hosts.equiv

Which I am not sure what they are for


The first two are for setting up certain settings like whether or not your computer runs a mail server, QuickTime Streaming Server, etc. The first is the actual file as used by the OS and the second, with the "~" character, is a backup.

The hosts.equiv file is used for storing host and user information relating to allowing remote logins. That's nothing to do with blocking web sites via the hosts file.

charlie

Blocking websites in Safari

Welcome to Apple Support Community
A forum where Apple customers help each other with their products. Get started with your Apple ID.