Ask Different is a question and answer site for power users of Apple hardware and software. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

When I edit my hosts file to redirect a URL to a specific IP address, nothing happens. My hosts file looks like this - this is in the directory /private/etc/hosts. I am not all that familiar with the Terminal nor it's commands so I'm having difficulty troubleshooting my problem.

The one thing I can think of is that I followed the following tutorial in an attempt to have SwitchHosts work in Firefox. Is there a way to reverse these steps? Would that even solve my problem?

share|improve this question
up vote 1 down vote accepted

Try running dscacheutil -flushcache as it sounds like it's not correctly doing flushing the cache to update it.

share|improve this answer
Thank you for your response! I've actually tried running that command numerous times but with no results. – Alan Breck Sep 23 '11 at 15:55
Ah, thought we might get lucky and find that it was a simple one. So if you've run switchhosts your hosts file now exists outside of /etc (kind of). The ln command creates a symbolic link between the files so /etc/hosts points to <username>/hosts. OS X reads /etc/hosts first and it's normally a symlink to /etc/private/hosts, so editing /etc/private/hosts won't update /etc/hosts. You can either edit the hosts file in <username>, or /etc/hosts and that should do it. – Nicholas Smith Sep 23 '11 at 16:38
Ok, so I tried editing the hosts file in <username> by typing the command nano hosts from within my <username> directory. I also tried editing the one in the 'etc' directory by typing nano /etc/hosts from within my <username> directory. Both files now have in them. It still doesn't work - the page points to the original IP address; not the one defined in my hosts file. – Alan Breck Sep 23 '11 at 20:36
Try deleting the hosts files found at <username>/ and /etc, then cp the /etc/private one over into /etc with sudo. It'll break that SwitchHosts thing, but might resolve your issue. – Nicholas Smith Sep 23 '11 at 22:33
That did it! Thank you so much! – Alan Breck Sep 26 '11 at 16:01

Note that and (or any other subdomain that comes before the word zionica) is a different domain, and the line as listed will not trap everything automatically by listing only the Second Level Domain.

www is a third-level domain, more commonly referred to as a 'sub-domain'.
zionica is the second-level domain. This word/placement on it's own generally does not have a more specific name.
com is a Top-Level Domain (TLD). Just like co, cc, org, net, ca, jp, uk, me, info, etc. (Everything except etc is a TLD.)

You can stuff multiple names into a single IP address line, so this is valid:

share|improve this answer
Thank you for your response. Unfortunately, it didn't end up solving my problem - but it was very helpful info! I wouldn't pass up the opportunity to learn something! – Alan Breck Sep 23 '11 at 20:01

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.