• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 1811
  • Last Modified:

editing mac osx 10.4 hosts file

Hi,  I've been trying in vain to edit the mac osx hosts file.  I've tried the following so far:

edit the host file in /etc:  I put in the ip address and the website address all the way at the bottom of the file and save it.  Then I do the following as instructed on several websites:

$ sudo niutil -create . /locations/lookupd/hosts

$ sudo niutil -createprop . /locations/lookupd/hosts LookupOrder FFAgent DNSAgent
      
$ sudo killall lookupd


After all this, i even restarted the machine, and it still doesn't work.  Any ideas?
0
ITatES
Asked:
ITatES
  • 3
  • 2
1 Solution
 
Eoin OSullivanConsultantCommented:
1. Can you provide a little more detail on what you're trying to achieve?

2. Can you supply the line you are adding to the hosts file? Obfuscate if necessary
0
 
ITatESAuthor Commented:
yes,

192.158.1.24 www.blahblah.com

I add that line to the hosts file and save it.  It doesn't work when typing in www.blahblah.com in the browser.  I read on a couple of websites that osx doesn't go to hosts file by default so you need to modify the lookupd for it to do that, and hence i tried the commands listed above.  Still it doesn't work.
0
 
Eoin OSullivanConsultantCommented:
OK ..

There should be no need to do anything other than edit the /etc/hosts file in OSX 10.4 (I think those tips were for OSX 10.1& 10.2)

You need to be a little careful with the hosts  file as it is locked to prevent standard users editing it .. you must also take care NOT to use anything other than a plain text editor like TextWrangler or a terminal based editor pico, vi etc. as the characters and line-endings can become affected and the host file will cease to function.

How did you edit the hosts file?  Do you have a backup you can restore and start again using the Terminal
In Terminal enter
sudo pico /etc/hosts
also make sure that you have a TAB between the IP address and the URL .. not a single space .. if necessary duplicate a line above and edit it
It should look more like
192.158.1.24         www.blahblah.com


0
Free Tool: Path Explorer

An intuitive utility to help find the CSS path to UI elements on a webpage. These paths are used frequently in a variety of front-end development and QA automation tasks.

One of a set of tools we're offering as a way of saying thank you for being a part of the community.

 
ITatESAuthor Commented:
strung, I went to that exact same site and tried the exact same thing.  

Sullivan, I had a tab before, but that didn't work so I changed it to a space.  
I saved the hosts file by first saving it on desktop and then replacing the one in /etc by the new saved one.  When I replaced, it asked for the admin password to overwrite and i entered it.
0
 
Eoin OSullivanConsultantCommented:
What program did you use to edit the hosts file?  If it was TextEdit on OSX you may have corrupted the file format and the hosts file will not work.

Can you restore a clean original of the hosts file and start again using the Terminal commands I provided?

0

Featured Post

Upgrade your Question Security!

Add Premium security features to your question to ensure its privacy or anonymity. Learn more about your ability to control Question Security today.

  • 3
  • 2
Tackle projects and never again get stuck behind a technical roadblock.
Join Now