I've looked through the internet and even saw a similair posted question, but didn't really give the answer I was looking for, so I'll see if I can get any better luck.
I recently had to modify my host file and add an IP and urls to it for some hosting migration I was performing. Well the migration has completed and I went back to change my host file back, I simply highlighted the text I entered earlier, hit delete, then Control-O then Control-X.
I soon saw that I was having errors when browsing on the internet and through it may have to do with my host file. I went back to find the complete file empty. I entered in the basic:
##
# Host Database
#
# localhost is used to configure the loopback interface
# when the system is booting. Do not change this entry.
##
127.0.0.1 localhost
255.255.255.255 broadcasthost
::1 localhost
fe80::1%lo0 localhost
And attempted to save it and got this error:
[ERROR WRITING private/etc/hosts: NO SUCH FILE OR DIRECTORY]
Everytime I try to save a new version, it simply says that I cannot since the file cannot be found. Can anyone advise me on what I should do to restore my host file to the way it was. I swear I'll never tinker around in here ever again.
Best Answer
It should be
/private/etc/hosts
. You're missing the/
at the beginning.