[英]Can't update hosts file on mac
When I try to save changes made in /etc/hosts file on mac i get this error: 当我尝试在mac上保存/ etc / hosts文件中所做的更改时出现此错误:
"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). 只需在vi主机之前使用“sudo”(它会询问管理员密码)。 By doing this I, basically, open hosts file with Administrator privileges:
通过这样做我基本上打开具有管理员权限的hosts文件:
$ sudo vi hosts
and the after modifications :wq
works just fine! 和后修改
:wq
工作正常!
Launch the Terminal 启动终端
$ sudo vi /etc/hosts
and after the modifications 并在修改后
:wq!
我的问题是我在运行sudo vi etc/hosts
而不是sudo vi /etc/hosts
hosts¯_(ツ)_ /¯
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.