homebrew

当mac系统更新到OSX 10.12后,用brew update,brew upgrade会有问题

xcrun: error: invalid active developer path (/Library/Developer/CommandLineTools), missing xcrun at: /Library/Developer/CommandLineTools/usr/bin/xcrun
xcrun: error: invalid active developer path (/Library/Developer/CommandLineTools), missing xcrun at: /Library/Developer/CommandLineTools/usr/bin/xcrun
xcrun: error: invalid active developer path (/Library/Developer/CommandLineTools), missing xcrun at: /Library/Developer/CommandLineTools/usr/bin/xcrun
Error: /usr/local is not writable. You should change the
ownership and permissions of /usr/local back to your
user account:
  sudo chown -R $(whoami) /usr/local

解决方案:
执行sudo chown -R $(whoami) /usr/local
执行完后恢复sudo chown root:wheel /usr/local


Mac系统的环境变量,加载顺序为:

/etc/profile
/etc/paths
~/.bash_profile
~/.bash_login
~/.profile
~/.bashrc

特别注意
/etc/paths中的内容:

/usr/bin
/bin
/usr/sbin
/sbin
/usr/local/bin

Homebrew安装的软件,其二进制执行文件都放在/usr/local/bin中,bin在使用时的查找不是覆盖原则,而是优先查找,所以例如mac已经自带了sqlite3,如果brew安装后,最新版的sqlite3是不会被调用的,因此可以将顺序修改一下以达到目的。

发表评论

电子邮件地址不会被公开。 必填项已用*标注

返回主页看更多
狠狠的抽打博主 支付宝 扫一扫