【问题标题】:brew install - permission denied (after chown -R `whoami` )brew install - 权限被拒绝(在 chown -R `whoami` 之后)
【发布时间】:2013-06-28 03:58:02
【问题描述】:
$ brew install fontconfig
Error: Permission denied - /Library/Caches/Homebrew/Formula/fontconfig.brewing

$ sudo chown -R `whoami` /usr/local

$ brew install fontconfig
Error: Permission denied - /Library/Caches/Homebrew/Formula/fontconfig.brewing

不知道从这里去哪里。运行 brew doctor 来解决一些现有问题,但似乎无法解决这个问题。

【问题讨论】:

  • 你没有chown系统目录。你可能想说sudo brew install fontconfig
  • Homebrew 不希望您在执行操作时使用sudo。即Error: Cowardly refusing to 'sudo brew install' You can use brew with sudo, but only if the brew executable is owned by root. However, this is both not recommended and completely unsupported so do so at your own risk.
  • 尝试使用磁盘医生修复文件夹权限
  • Homebrew install issues的可能重复

标签: macos homebrew


【解决方案1】:

对于其他遇到类似错误的人

$ brew upgrade
==> Upgrading 1 outdated package, with result:
libtool 2.4.6
==> Upgrading libtool
Error: Permission denied - /usr/local/lib/libltdl.7.dylib

确保您的目录(在本例中为 /usr/local/lib)具有足够的权限供您访问。我遇到了仅分配给root:admin 的问题。

$ ls -la /usr/local/lib/ | grep "libltdl.7"
lrwxr-xr-x   1 username  admin        43 Oct 12  2014 libltdl.7.dylib -> ../Cellar/libtool/2.4.2/lib/libltdl.7.dylib

将其切换为 myusername:admin 并且能够毫无问题地升级。

cd /usr/local/lib
sudo chown `whoami`:admin .

希望有帮助!

【讨论】:

  • 这是一个很好的解决方案,但不安全!见stackoverflow.com/questions/16432071/…
  • @redolent - 非常好的观点。我同意!不幸的是,似乎 brew 正在寻找这个(来自您发布的链接)-“it may be insane but it is what brew itself suggests: $ brew update Error: The /usr/local directory is not writable. Even if this directory was writable when you installed Homebrew, other software may change permissions on this directory. Some versions of the "InstantOn" component of Airfoil are known to do this. You should probably change the ownership and permissions of /usr/local back to your user account. sudo chown -R $(whoami):admin /usr/local
  • 所以本质上是想要这样的权限?
【解决方案2】:

trojanfoe 的回答有所帮助。我没有分配到的 Library/Logs 文件夹存在权限问题,但不知何故,Library/Caches/Homebrew 文件夹不存在。所以我刚刚创建了子文件夹Formula,并更改了权限,一切都安装得很好。它实际上清除了我遇到的很多错误。

谢谢大家。

更新

@fet 的一个班轮效果很好。

mkdir -p ~/Library/Caches/Homebrew/Formula

【讨论】:

  • 也为我工作。单线:mkdir -p ~/Library/Caches/Homebrew/Formula
  • 也为我工作,但我不知道为什么。
  • 这里也修复了!这是自制软件的错误吗...?
猜你喜欢
  • 1970-01-01
  • 1970-01-01
  • 2020-10-23
  • 2011-08-30
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
相关资源
最近更新 更多