-
Notifications
You must be signed in to change notification settings - Fork 148
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Hosts file does not work on newer versions of OSX #60
Comments
Interesting. The post seem to imply that this is something that started in OSX 10.7. Do you know if this is the case, or whether it happens in earlier versions? |
Honestly, I'm second guessing my bug report now after digging in more. I think it's the fact that I am using fake domains with real TLDs (fake-site.com) for local development since hostnames with completely bogus TLDs (my.app) work fine. Strangely, Chrome can access the local development site fine, but Safari cannot, and system tools like This is definitely new with Mavericks, but I'm now not sure this is a vagrant-hostmanager issue, as such I am going to close my own issue until I have more information. |
I'm reopening this as I have confirmed it, plus another issue: http://stevegrunwell.com/blog/quick-tip-troubleshooting-etchosts-issues/
The way vagrant hostmanager currently writes the host file (at least on OSX) causes the aliases to be ignored by all apple software (safari, iOS simulator, even As soon as I tweaked the /etc/hosts entries, everything loaded quickly. |
👍 |
@dpehrson I read your comments with interest as I had issues on my end. Turned out my issues were unrelated (I'll open a separate issue). But I'm on a clean install of Mavericks (10.9.2) with a standard /etc/hosts file that works as expected with no bugs:
Is it possible that your issues arise from something else? Did you do an upgrade install of your OS that might have had problems? Could you do a quick OS install to a second hard drive and test there? I'm not sure this is a vagrant issue per se ... |
There is a bug in OSX related to having too many host aliases on the same line. It appears to break somewhere between 6 and 7 host aliases. for example, in /etc/hosts (old version of hostmanager, but irrelevant since it's not a hostmanager bug)
Note how most resolve as expected, but a few of them took 35 seconds... move any two of the above aliases to a new line...
and presto!
Note: if you're using an old version of hostmanager, you can use this one-liner for sed to auto-split the lines:
|
@delphyne Thanks for providing some more concrete evidence here. With this said, can we get a thumbs up or down from maintainers to see whether this should in fact be fixed? One-host-per-line will work on all operating systems, the current setup makes the plugin very annoying to use on OSX. |
as an update, this awk script will work for hostmanager 1.4's new format
|
I think this should be fixed if it's making life difficult for OSX users. It seems to me that the one-host-per-line would be the most straight-forward solution. I've searched around and haven't found any indication of this causing issues on any of the major OSes. The closest discussion I found was this, but their main concern is overwriting reverse-lookup of 127.0.0.1. In our case, we're not using the localhost IP or name. So I think it should be okay, and a pretty easy fix. @smdahlen, do you have any thoughts on this? PS. Sorry for the delay in getting to this. |
Something here is still messed up. I'm on OSX 10.9.5 and /etc/hosts basically stopped working at some point. I'm not sure when, but it's not due to these issues discussed here. (Many hostnames per line, which dang well SHOULD work, Apple! C'mon now! Why on earth would you mess with that?) (Nor entries only at the "top" of the file.) I removed these comment lines and IPV6 entries at the top of my file, and now it works. I have no idea what was wrong in here. Maybe I disabled IPv6 on this laptop, and now those entries are invalid. Anyway Apple has clearly introduced many BUGS regarding /etc/hosts. Fix please! Sheesh! This stuff has worked since 1969! If it ain't broke, .. .. . .. !!!! Paul |
@dpehrson This worked. I also tried putting multiple hosts on one line and as you've stated. It does not work. Each host MUST be on it's own line. Thanks for the help. |
If I get some time I may work on a pull request for this, but in the meantime I want to get it documented.
Problem: OSX ignores
/etc/hosts
entries unless they are at the TOP of the file.Solution: Prepend instead of append when adding entries, at least on OSX.
Reference: http://thecoredump.org/2011/09/editing-the-hosts-file-in-mac-os-x-lion/
The text was updated successfully, but these errors were encountered: