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!
我的问题是我在运行sudo vi etc/hosts
而不是sudo vi /etc/hosts
hosts¯_(ツ)_ /¯
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.