Tiger Equivalent to Windows' .hosts?

Discussion in 'Mac Basics and Help' started by Mhaddy, Nov 5, 2005.

  1. Mhaddy macrumors 6502

    Mhaddy

    Joined:
    Oct 26, 2005
    Location:
    Canada
    #1
    Hi guys,

    I'm the proud owner of a new 2.0DC PowerMac and I absolutely love it! I run a web server that hosts several websites to which my PowerMac is connected via an internal LAN. Each website that I host has its own domain name, so on my old windows machine, I'd have to edit my .hosts file and add entries like:

    192.168.1.103 maddogstudios.net

    ...to bind the maddogstudios.net domain to my local (internal) LAN IP of the server hosting it (I hope that's not confusing!).

    Anyhow, I was wondering what Tiger's equivalent to this Windows .hosts file is. Hope to hear from you soon, thanks!
     
  2. freiheit macrumors 6502a

    Joined:
    Jul 20, 2004
    Location:
    California
    #2
    Hosts file

    The Tiger equivalent is, not surprisingly, the hosts file. Yep, it's an old UNIX thing that's come along down to OS/2 and Windows, etc. You'll find it in the top level /etc directory I believe.
     
  3. savar macrumors 68000

    savar

    Joined:
    Jun 6, 2003
    Location:
    District of Columbia
    #3
    Type "man hosts" in the terminal and read the documentation that comes up.
     
  4. Mhaddy thread starter macrumors 6502

    Mhaddy

    Joined:
    Oct 26, 2005
    Location:
    Canada
    #4
    Thanks for the quick response, guys. Oddly enough, soon after I posted the thread, I found out about the /etc/hosts file, heh. I was in Terminal and typed "pico hosts" (once inside the /etc/ dir). When I tried to save the file though, it gave me a permission denied error. I know I'm an admin on this PC (I'm the only user on it!)... so is there a program that I have to exit or a certain way of opening the file that will allow me to edit it?

    Thanks!

    Edit: I figured it out :). Thanks again guys.
     
  5. PCheese macrumors member

    Joined:
    Aug 9, 2004
    #5
    When you do figure out the answer, it's good to post it in case other people come across the same thread with the same question.

    The answer is to use sudo:
    Code:
    sudo pico /etc/hosts
     
  6. Mhaddy thread starter macrumors 6502

    Mhaddy

    Joined:
    Oct 26, 2005
    Location:
    Canada
    #6
    That actually didn't work for me -- it gave me a permission denied error. What I did was:

    - Open up Terminal
    - Type: sudo nano /etc/hosts
    - (enter your password)
    - do your edits
    - Type: lookupd -flushcache

    Jeff Hubbach from the Apple support forums helped me out with this.
     
  7. JDar macrumors 6502a

    JDar

    Joined:
    Dec 7, 2003
    #7
    There is a shareware program called "Hostal" that you can find on VersionTracker that allows easy additions and deletions to your Hosts file. It's by Northern Software http://www.northernsoftworks.com/ which does some neat small programs. I've had Hostal going for years and don't know of any problem it has ever caused.
     

Share This Page