macOS 12.6 关闭 SIP 后仍无法修改 /etc 文件夹下文件 如hosts

 
关闭sip

开机按住Commond+R,进入系统Recovery模式,从terminal中将系统保护SIP关掉(csrutil authenticated-root disable;csrutil disable)
重启开机进入系统,可以在终端查看是否已将SIP关掉(csrutil status;csrutil authenticated-root status),都显示Disable即可;


root执行命令
chflags nohidden,noschg,nouchg /etc/hosts
chmod 777 /etc/hosts
vi /etc/hosts
chmod 644 /etc/hosts
chflags hidden,schg /etc/hosts


解决问题后,不要忘记再次重启进入Recovery模式,打开terminal,输入:
csrutil enable
csrutil authenticated-root enable
重新开启SIP以免系统失去安全防护

 

posted @ 2023-06-26 16:02  ji007  阅读(369)  评论(0)    收藏  举报