why cannot I edit my `hosts` file? I'm trying to edit my hosts file, because doing ssh &lt;some host in hosts&gt; fails to translate to ip.

according to the Finder UI it is found under:


however when trying to run cat hosts from the terminal I get an error:

➜  /etc  cat hosts
cat: hosts: No such file or directory


I tried to create a new hosts file but then I see another one is created next to the first one



but when I try to edit the second hosts I need to duplicate to anther destination. I copy it to /etc and again the first problem occurs.

I have tried to change the permissions to everyone can read and write. But yet it didn't help.
Usually only the root user is allowed to modify the file hosts.

To do that and fix your hosts file or your /etc folder (depending where you applied your read/write permissions) follow these steps:


Throw away your newly created hosts file (but not the old one!)
Repair your permissions with Disk Utility.

Open Terminal and enter sudo nano /etc/hosts and hit ↵
Enter your password (it will not be shown!) and hit ↵
The standard hosts file in Yosemite looks like this:

Edit your hosts file.
The format for each line is IP-address, then a tab or a single space and the hostname(s). Terminate the file with an empty trailing line.
write the changes to disk with ctrlO followed by ↵
and exit nano with ctrlx
Enter exit, hit ↵ and quit Terminal.app


As an alternative for the steps 3-7 you may download and install hosts.prefpane and enter your additional hosts there.