Homebrew update error not work on OSX

brew update 錯誤是這樣的git

chown: /usr/local: Operation not permitted

而後網上osx 10.11, 10.12的解決方法這樣的github

The problem mainly occurs after updating OS X to El Capitan (OS X 10.11) or macOS Sierra (macOS 10.12). This is mainly because of file permission issues with El Capitan’s or later macOS's new SIP process. Try changing permissions of /usr/local directory.
$ sudo chown -R $(whoami):admin /usr/local 
If it still doesn't work, use following steps and everything will be fine. This may be because homebrew is not updated.
1. open terminal 
2. $ cd /usr/local/Library/Homebrew 
3. $ git reset --hard 
4. $ git clean -df
5. $ brew update

10.13以後庫克怒了,無論你怎麼執行命令都不讓你運行 哪怕是root ,因此有人這麼幹:api

看來只有關掉SIP了

1.重啓Mac,按住Command + R鍵直到Apple Logo出現,進入Recovery Mode模式(我感受我是按了好半天)

2.點擊工具裏的Terminal(終端)

3.輸入csrutil disable,以後回車

4.重啓Mac

5.重啓完成後,終端中輸入 sudo chflags norestricted /usr/local && sudo chown -R $(whoami):admin /usr/local

成功執行,沒有報操做不容許了

(若是想從新開啓安全設置,則重複一、2步驟,輸入csrutil enable就能夠了)

 

然而根本沒這麼麻煩 這樣就能夠搞定 OS X 10.13 brew not work (簡單的說就是卸載了再安裝)安全

/usr/bin/ruby -e "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/uninstall)」
/usr/bin/ruby -e "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install)"
相關文章
相關標籤/搜索