Blog

How to edit the host file on Mac (Leopard)

The host file is used to by an operating system to map hostnames to IP addresses. It’s useful for testing local files as remote domains. On Windows systems is typically located at

c:/windows/system32/drivers/etc/hosts

On a Mac you can edit the host file by opening up the Terminal app and typing in:

$ sudo nano /private/etc/hosts


Sudo is the superuser command so you’ll be prompted for your password.

Once you’ve edited the file you can exit out by ctrl+x (you’ll be prompted to save the file).

The last step is to flush the DNS cache, to have your chances take effect immediately. In Leopard you can do this by typing in:

$ dscacheutil -flushcache

That’s all. Your new binding should now work.

2 Comments

  • any thoughts on whether upgrading to Snow Leopard is a good idea? Should I order it now or wait a bit? Thoughts? Feelings? Lamp?

    may god have mercy on our souls,
    - r

    • I think updating is a good idea. I’ve ordered Snow Leopard but it doesn’t ship until Friday, 8/28, so I haven’t tried it yet. I’ll let you know if stuff breaks :)

Leave a Reply

Get your own Gravatar. RSS feed for comments on this post. TrackBack URL.

Please note: Comment moderation is enabled and may delay your comment. There is no need to resubmit your comment.

You can use these HTML tags in your comments: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>

Busy. Not taking on projects