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

How do I add a host file to my macbook OS X 10.6?

I cannot access a favourite website at the moment and this is recognised by the site. the advice is to add the IP address and name to the host files but i am baffled as to how to do this!! I gather it has something to do with simply going to "/etc/hosts" .....but how do I get there/do this? I've tried opening applications/terminal then typing the above in but it says permission denied. Please help!!

Posted on May 5, 2011 4:05 AM

Reply
Question marked as Best reply

Posted on May 5, 2011 4:11 AM

You need the terminal to do it:


- Open terminal.

- Type:

sudo /Applications/TextEdit.app/Contents/MacOS/TextEdit /etc/hosts

- Enter your password.

- In TextEdit, edit the file and save it.

7 replies

May 5, 2011 4:44 AM in response to doktorV

Although you can open the /etc/hosts file and add a line mapping an IP address to a domain name, that is not a proper solution to this problem. If you are having trouble accessing a site via its domain name but not by IP address, that indicates a problem with your selected DNS server. You may need to switch to another DNS server, such as the Google DNS servers or OpenDNS.

May 5, 2011 4:48 AM in response to plcn

thanks but a few more questions as that didn't seem to work (sorry if this is super-basic and i'm being a dunce - not long had a mac and definitely never done anything like this before or used Terminal)


1. i typed what you said to above and hit Return. It gave me a warning about sudo commands having potential harmful effects but after putting it in, it then simply wrote this next:

sudo /Applications/TextEdit.app/Contents/MacOS/TextEdit/etc/hosts : command not found



2. Was I wrong to hit Return after typing what you said or should I have put in a space and then my password then hit Return?


3. is there something specific about the way you typed that eg. the space between 'sudo' and the '/Applications' - is that on purpose?


4. what is TextEdit where I 'edit the file and save it'? is that a program or application? (again...sorry if i am asking really simple/obvious questions!)


Thanks for the quick reply before. :-)

May 5, 2011 4:59 AM in response to doktorV

Hi,


First of all, you need a space between "sudo", "/Applications/TextEdit.app/Contents/MacOS/TextEdit" and "/etc/hosts". Paste the following (without quotes): "sudo /Applications/TextEdit.app/Contents/MacOS/TextEdit /etc/hosts". The command will open the /etc/host file with TextEdit, a graphical editor, with administrator permissions (for modifying the /etc/hosts).


Hit return, and you will be prompted for your password. Enter it and hit enter.


TextEdit, the Mac OS X "notepad" will open and you will see the content of the /etc/hosts file. Add the desired entries, then save the file and quit TextEdit

May 5, 2011 5:24 AM in response to doktorV

thank you everyone for your advice and thanks heaps picn - it worked!


point taken thomas - i ahd come across this earlier on another forum where someone made the point that when the site alters/mends the issue it may/will be with a different address? in which case i'd have to go back into this i assume and delete what i just put in?


cheers again everyone for your help :-)

How do I add a host file to my macbook OS X 10.6?

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