Lost 'hosts' file?

Discussion in 'Mac Basics and Help' started by AmbaGambla, Dec 7, 2009.

  1. AmbaGambla macrumors newbie

    Joined:
    Feb 20, 2009
    #1
    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!)
     
  2. zachsilvey macrumors 6502

    Joined:
    Feb 5, 2008
    Location:
    Battle Ground
    #2
    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
    
     
  3. AmbaGambla thread starter macrumors newbie

    Joined:
    Feb 20, 2009
    #3
    ok, thanks.

    How would I go about recreating it?
     
  4. zachsilvey macrumors 6502

    Joined:
    Feb 5, 2008
    Location:
    Battle Ground
    #4
    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.
     
  5. AmbaGambla thread starter macrumors newbie

    Joined:
    Feb 20, 2009
    #5
    Ah-ha

    I'm in and have found the problem!

    Thanks for your help!
     

Share This Page