以root身份安装后如何修复Homebrew权限?


10

我以root身份运行brew,现在已经不存在了。不再更新。怎么修?

$ brew update && brew upgrade
error: Unable to append to .git/logs/HEAD: Permission denied
error: Unable to append to .git/logs/refs/remotes/origin/master: Permission denied
Error: Failed to update tap: caskroom/cask

$ brew doctor
Please note that these warnings are just used to help the Homebrew maintainers
with debugging if you file an issue. If everything you use Homebrew for is
working fine: please don't worry and just ignore them. Thanks!

Warning: Your XQuartz (2.7.4) is outdated
Please install XQuartz 2.7.7:
  https://xquartz.macosforge.org

以root身份运行brew只是在麻烦。不要做!

Answers:


23

将/ usr / local和Homebrew的缓存的权限重置为当前用户:

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

1
您可能还需要〜/ Library / Logs / Homebrew
Sam Brightman

0

最坏的情况是,只需重新安装Homebrew。对于我来说,它有所帮助:

/usr/bin/ruby -e "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install)"

在重新安装自制软件之前,我会先卸载“损坏的”软件!
klanomath
By using our site, you acknowledge that you have read and understand our Cookie Policy and Privacy Policy.
Licensed under cc by-sa 3.0 with attribution required.