MacOS – why cannot I edit the `hosts` file

finderhostsmacosNetworkterminal

I'm trying to edit my hosts file, because doing ssh <some host in hosts> fails to translate to ip.

according to the Finder UI it is found under:

enter image description here
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

enter image description here

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.

Best Answer

There shouldn't be a way to have two identically named files in the /etc folder. Can you do a Get Info on the original and verify the Name & Extension (and that the extension is not hidden, and that there are no spaces at the end of the name)?