brew package not linked 錯誤處理

lovXin發表於2017-02-07

brew package can`t link 問題

有時候brew install [package]之後執行brew doctor自檢會出現not link錯誤

 ~/ brew doctor
Warning: You have unlinked kegs in your Cellar
Leaving kegs unlinked can lead to build-trouble and cause brews that depend on
those kegs to fail to run properly once built. Run `brew link` on these:
  libevent

執行brew link發現:

~/ brew link libevent
Linking /usr/local/Cellar/libevent/2.1.8...
Error: Could not symlink include/evdns.h
/usr/local/include is not writable.

這就要求我們改變一些系統資料夾的讀寫許可權,要根據自己資料夾的實際情況去寫

sudo chown -R usrname:admin /usr/local/
sudo chown -R usrname:admin /usr/include/
sudo chown -R usrname:admin /Library/...

其中usrname在系統偏好設定——使用者與群組中查詢

再執行:

 ~/ brew link libevent
Linking /usr/local/Cellar/libevent/2.1.8... 817 symlinks created

問題解決。

需要注意的是:現在macOS 10.12已經禁止brew命令使用超級許可權sudo

相關文章