PDA

View Full Version : Help: Editing hosts under OS X




j763
Apr 5, 2002, 09:13 PM
Hi!

I'm wondering if there's anyone who knows how to edit the hosts file in OS X (what's provided on the following site for MacOS only works for Mac OS 9 and below) ... What I want to achieve is this (http://www.ecst.csuchico.edu/~atman/spam/adblock.shtml).

I tried, firstly to edit the hosts file in the /etc/ directory, so i opened up terminal and typed in:

[localhost:~] jackkenn% su
Password:
[localhost:/Users/jackkenn] root# cd..
[localhost:/Users] root# cd..
[localhost:/] root# cd etc
[localhost:/etc] root# pico hosts


And up came this...


##
# Host Database
#
# Note that this file is consulted when the system is running in single-user
# mode. At other times this information is handled by lookupd. By default,
# lookupd gets information from NetInfo, so this file will not be consulted
# unless you have changed lookupd's configuration.
#
# 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


So apparently the hosts info in that file only loads when you're booted into single user mode (cmd+s on startup), otherwise it should refer to NetInfo... So I went into NetInfo and duplicated "localhost" and "broadcasthost" under "/machines"... To test whether this in fact works, I tried to block "yahoo.com"... After messing around for a long time, I still haven't been able to make it work... :mad: If you're interested, please give this a go... Post here and email me plz (j763@mac.com (mailto:j763@mac.com)) if you get it to work properly!