Lost 'hosts' file?

AmbaGambla

macrumors newbie
Original poster
Feb 20, 2009
24
0
A few months back, I edited the hosts file on my mac so that I could access the work database from my laptop.
I eventually made it work, and I've just tried to come and use it again, but it doesn't work. I've found what I need to add to my 'hosts' file, but can't seem to find the file anywhere....

From what I understand, it should be in /private/etc/hosts - but it doesn't seem to be there..... is this bad? Where might it be hiding?

thanks for you help!

(PS - I'm not very mac-savvy, so idiots language would be helpful!)
 

zachsilvey

macrumors 6502
Feb 5, 2008
444
3
Battle Ground
The hosts file is a left-over from the pre-dns world. It tells your computer which ip address a URL should be directed to. It isn't completely nessesary but you can just recreate it.

This is the default hosts file in OS X
Code:
##
# 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
 

zachsilvey

macrumors 6502
Feb 5, 2008
444
3
Battle Ground
open up the "Terminal" app and type the command
Code:
sudo nano /private/etc/hosts
Code:
paste the contents into the terminal

press control + o and enter to write out the file

press control + x and enter to exit nano

then quit Terminal
I think it takes a reboot for the changes to take effect but I'm not 100% percent sure.
 
Register on MacRumors! This sidebar will go away, and you'll see fewer ads.