HomeBrew:错误 - / usr / local / Cellar不可写

时间:2016-11-21 06:10:39

标签: macos homebrew

当我在终端中运行以下命令时:

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

我收到错误:

/usr/local/Cellar is not writable. You should change the
ownership and permissions of /usr/local/Cellar back to your
user account:
sudo chown -R $(whoami) /usr/local/Cellar

在/ usr / local / bin / brew update --force

期间失败

我在S.O上发过类似的帖子,所有人都有以下命令作为答案,所以我在终端中运行了以下命令:

  1. sudo chown -R $tejas /usr/local/Cellar
  2. sudo chown -R $tejas:admin /usr/local/Cellar
  3. sudo chown -R $tejas /usr/local
  4. sudo chown -R $tejas:admin /usr/local
  5. 我在以上四个命令之后运行了安装命令,但它仍然给我错误。有人可以帮我解决这个问题。谢谢。

5 个答案:

答案 0 :(得分:7)

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

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

答案 1 :(得分:5)

我有完全一样的问题。我试图重置权限,但是某些软件包仍然无法安装。重新安装Homebrew为我解决了这个问题:

卸载:
ruby -e "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/uninstall)"

,然后重新安装:
/usr/bin/ruby -e "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install)"

答案 2 :(得分:0)

如评论中所述,只需(不做任何替换)即可:

sudo chown -R $(whoami) /usr/local/Cellar

答案 3 :(得分:0)

在@Lemaitre Cedric和@Rexcirus的帮助下...我解决了问题。

sudo chown -R $USER:admin /usr/local /Library/Caches/Homebrew
sudo chown -R $(whoami) /usr/local/Cellar

答案 4 :(得分:0)

在MacOS上安装GoAccess时遇到相同的问题:

Error: /usr/local/Cellar is not writable. You should change the
ownership and permissions of /usr/local/Cellar back to your
user account:
  sudo chown -R $(whoami) /usr/local/Cellar
Error: The following directories are not writable by your user:
/usr/local/Cellar
/usr/local/share/zsh
/usr/local/share/zsh/site-functions

我通过运行以下命令对其进行了修复:

 sudo chown -R $(whoami) /usr/local/Cellar /usr/local/share/zsh /usr/local/share/zsh/site-functions