Mavericks and editing /etc/hosts file

Contributor II

It seems as though Mavericks is ignoring changes to the hosts file. I use:

sudo vi /etc/hosts

Make changes as necessary and then run

sudo killall -HUP mDNSResponder


sudo dscacheutil -flushcache (just in case)

But the changes to the hosts file are not taking. No matter what I do it does not seem to see the changes to the hosts file and still pings an incorrect address? Has anyone figured out a workaround?


New Contributor II

Contributor II

It's not the browser I need to direct to this address. Mail is trying to hit a DMZ address and not an external address, due to internal DNS and some vpn tunneling I need them to use the external public IP and not the DMZ IP.

Valued Contributor

Does a reboot work after editing the file? If not, then restarting services isn't going to help and the problem lies elsewhere.


May want to consider a "Resolver" file instead.
Check this out:

A bunch more stuff if you google search it.

Essentially, it's just a directory and a file at /etc/ called resolver/
In there you put a file (no . extension, just the file), called the domain you're trying to resolve to.

I gave the folder and file perms of 755 and owner 0:0.
This worked instantly once in place. No browser relaunch, no reboot necessary, no caches to clean. Tested on 10.6 - 10.9.2 w/out issue