brew安装软件报错:Error: Permission denied - /usr/local/opt/jpeg

在MacOS使用brew安装libjpeg,报没有权限:

$ brew install libjpeg
==> Downloading https://downloads.sf.net/project/machomebrew/Bottles/jpeg-8d.mountain_lion.bottle.1.tar.gz
Already downloaded: /Library/Caches/Homebrew/jpeg-8d.mountain_lion.bottle.1.tar.gz
==> Pouring jpeg-8d.mountain_lion.bottle.1.tar.gz
Warning: Could not link jpeg. Unlinking...
Error: The brew link step did not complete successfully
The formula built, but is not symlinked into /usr/local
You can try again using `brew link jpeg'
Error: Permission denied - /usr/local/opt/jpeg

解决方法:

在MacOS High Sierra,/usr/local目录不能再使用chown。替代方案为:

sudo chown -R $(whoami) $(brew --prefix)/*

参考:https://github.com/Homebrew/brew/issues/3228

版权声明:著作权归作者所有。

相关推荐

CentOS安装R包报错:/usr/bin/ld: cannot find -lgfortran

在CentOS上已经安装了gfortran,使用which可以找到它的安装路径:$which gfortran usr/bin/gfortran 但在安装R包时却报:/usr/bin/ld: cannot find -lgfortran解决方法检查gfortran,gcc,g++的版本也是匹配,所以可以确定的是R找不到gfortran,解决方法是新建~/.R

卸载使用brew安装的mongodb脚本

这个用来卸载Mac使用brew安装的mongodb。#!/usr/bin/env sh # 检查mongo是否在运行中 launchctl list | grep mongo launchctl unload ~/Library/LaunchAgents/homebrew.mxcl.mongodb.plist launchctl remove homebrew.mxcl.mong