gpt4 book ai didi

macos - 如何修复 Homebrew 权限?

转载 作者:行者123 更新时间:2023-12-03 03:54:17 30 4
gpt4 key购买 nike

我现在已经卸载并安装了 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 读到的内容

$ 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 解决问题:

sudo chown -R "$USER":admin /usr/local

此外,您(很可能)必须在 /Library/Caches/Homebrew 上执行相同的操作:

sudo chown -R "$USER":admin /Library/Caches/Homebrew

显然我之前使用过 sudo ,这改变了我对 /usr/local 的文件夹权限,从这里开始,所有使用brew的安装都被证明是成功的。

此答案来自 gitHub's homebrew issue tracker

关于macos - 如何修复 Homebrew 权限?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/16432071/

30 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com