According to the Apple developer documentation, setting HOSTALIASES will make a process look in that file for hostnames instead of /etc/hosts.

However when I tested this with ping and a replacement hostfile, the replacement never got used, only /etc/hosts (according to fs_usage) - I have also seen similar complaints online.

Is there a way to get a process to respect HOSTALIASES or otherwise use a different hosts file?


The man page that you referenced is very old (ancient) - it's from 1995. Looking at the man page for gethostbyname on a machine running El Capitan (2006), that reference is no longer there meaning it's a very good indication that what you are looking for has been deprecated.

| improve this answer | |

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .