我现在已经卸载并安装了 Homebrew 3 次,因为它似乎永远不允许我安装任何东西,因为它在大多数安装结束时拒绝了我的权限。
作为一个例子,我将发布我目前面临的这个 libjpeg 下载场景。
我尝试安装 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
‘brew link jpeg’ 结果
Error: Permission denied - /usr/local/opt/jpeg
这是我的酿酒医生读到的
$ brew doctor Warning: "config" scripts exist outside your system or Homebrew directories. ./configure scripts often look for *-config scripts to determine if software packages are installed, and what additional flags to use when compiling and linking. Having additional scripts in your path can confuse software installed via Homebrew if the config script overrides a system or Homebrew provided script of the same name. We found the following "config" scripts: /Library/Frameworks/Python.framework/Versions/2.7/bin/python-config /Library/Frameworks/Python.framework/Versions/2.7/bin/python2-config /Library/Frameworks/Python.framework/Versions/2.7/bin/python2.7-config 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: jpeg
这个权限问题使得 brew 无法在任何东西上使用,我非常感谢任何建议。
我能够通过chown在文件夹上使用来解决问题:
chown
sudo chown -R "$USER":admin /usr/local
此外,您(很可能)必须在以下方面做同样的事情/Library/Caches/Homebrew:
/Library/Caches/Homebrew
sudo chown -R "$USER":admin /Library/Caches/Homebrew
显然,我以前使用sudo过更改我的文件夹权限的方式/usr/local,从这里开始,所有使用 brew 的安装都被证明是成功的。
sudo
/usr/local
这个答案来自gitHub 的自制问题跟踪器