OSX Lion Gotcha! – /etc/hosts file

I had the hardest time setting up Mura today on my 2008 MacBook Pro. It wasn’t even the fault of Mura, Apache, or Tomcat/Railo but of my hosts file.

This post got me over the hump: Mac OS X Lion /etc/hosts file.

What a weird change. I also hit a wall with some Apache config file changes but I’ll fool w/ those later.

Due to the linked site not working any longer, I am copying the post here. The original post is from Gargoyle’s Blog.

Just doing some early testing with Lion to make sure I can get all my dev environment up and running and have just came along a little quirk.

This is how the default hosts file looks:-

# Host Database
# localhost is used to configure the loopback interface
# when the system is booting.  Do not change this entry.
##	localhost	broadcasthost
::1             localhost
fe80::1%lo0	localhost

Nothin unusual. However, if you are used to adding lines like:-

" local-test-app"

to the end of the file, then it might throw you off a little bit as it seems you now have to have them above the fe80::1%lo0 line.

  • http://ga.rgoyle.com Gargoyle

    Was this an upgrade or a clean install?

    • http://www.johncblandii.com johncblandii


  • http://robwilkerson.org Rob Wilkerson

    This is really weird. I’m also having hosts issues since upgrading, but nothing has worked completely. I can ping a few hosts entries, but not others and some only return after several seconds of delay. Something is definitely amiss here…

    • http://www.johncblandii.com johncblandii

      What\’s funny is my main Mac is running just fine w/ no host file changes. It is very weird.

      Now that I think of it, my old Mac worked fine on some hosts but the new one I added didn\’t work. Weird.

  • http://twitter.com/ds_heck David

    I ran into something similar.  Thanks!

    • http://www.johncblandii.com John C. Bland II

      Awesome. Glad I could help.

  • infidelphia


    • infidelphia

      sike, the link is dead

      • http://www.johncblandii.com John C. Bland II

        DOH! I’ll update the post w/ the fix.

      • http://www.johncblandii.com John C. Bland II

        The post is updated with the fix from the other site. The blog is still up but there is an issue with the page links and there is no way to contact them.

  • Guy

    great tip. fixed my problem

  • Chris Stainton

    It will not work directly in Mountain Lion or Lion since /etc/hosts is no longer supported directly.

    Check this post out: