When I try to save changes made in /etc/hosts file on mac i get this error:
"hosts" E212: Can't open file for writing
How can I update it?
I found the solution:
just use "sudo" before vi hosts (it will ask for administrator password). By doing this I, basically, open hosts file with Administrator privileges:
$ sudo vi hosts
and the after modifications :wq
works just fine!
Launch the Terminal
$ sudo vi /etc/hosts
and after the modifications
:wq!
My problem was that I was running sudo vi etc/hosts
instead of sudo vi /etc/hosts
¯_(ツ)_/¯
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With