最近在mac上操作文件發現提示
chmod: Unable to change file mode on /usr/bin/cc: Operation not permitted
發現是El Capitan(10.11) 加入了Rootless機制,很多系統目錄不再能夠隨心所欲的讀寫了,即使設置 root 權限也不行。
以下路徑無法寫和執行
/System
/bin
/sbin
/usr (except /usr/local)
加入這個機制主要是為了防止惡意程序的入侵,更多我們可以查看官網
https://developer.apple.com/videos/play/wwdc2015/706/
如何關閉
重啟按住 Command+R,進入恢復模式,打開Terminal
csrutil disable
如何開啟
重啟按住 Command+R,進入恢復模式,打開Terminal。
csrutil enable
備注:上面方法過於復雜,而且會破壞原來的mac的安全機制,建議使用以下方法:
chmod -R 777 localhost.com(指定文件)