Sunday, 8 November 2015

/etc/hosts on OSX

I almost never post about a specific programming or setup issues, but this really caused me hours of pain so I try to prevent others going through the same.
OSX seems to ignore /etc/hosts file during DNS resolution. If you google it you will find thousands of results for different versions of OSX and hundreds of comments "it works for me" or "it doesn't work for me". The solution that worked for me I found in a comment of a blog entry. Permissioning. After adding global read access to /etc/hosts everything works as expected.
sudo chmod o+r /etc/hosts
That's it. Hope it helps someone out there.