Brew 安装 R:权限被拒绝

SPR*_*BRN 8 permissions homebrew r macos macos-mojave

当尝试通过 Brew 安装 R 时,我收到以下输出和错误:

==> Pouring pcre-8.43.mojave.bottle.tar.gz 
cp: /usr/local/Cellar/pcre/./8.43: 
cp: /var/folders/3l/zsdg6x9x61g8nhnb8f6pxzvw0000gn/T/d20190415-7574-1t8em0n/pcre/./8.43: unable to copy extended attributes to /usr/local/Cellar/pcre/./8.43: Permission denied
cp: /usr/local/Cellar/pcre/./8.43/INSTALL_RECEIPT.json: No such file or directory
cp: /usr/local/Cellar/pcre/./8.43/bin: No such file or directory

....

cp: utimes: /usr/local/Cellar/pcre/.: Operation not permitted
Error: Failure while executing; `cp -pR /var/folders/3l/zsdg6x9x61g8nhnb8f6pxzvw0000gn/T/d20190415-7574-1t8em0n/pcre/. /usr/local/Cellar/pcre` exited with 1. Here's the output:
cp: /usr/local/Cellar/pcre/./8.43: Permission denied
cp: /var/folders/3l/zsdg6x9x61g8nhnb8f6pxzvw0000gn/T/d20190415-7574-1t8em0n/pcre/./8.43: unable to copy extended attributes to /usr/local/Cellar/pcre/./8.43: Permission denied

....

Warning: Bottle installation failed: building from source.
Error: An exception occurred within a child process:
  Errno::EACCES: Permission denied @ dir_s_mkdir - /usr/local/Cellar/pcre/8.43
Run Code Online (Sandbox Code Playgroud)

我正在管理员帐户下安装它。通过我的普通非管理员帐户,我会遇到更多麻烦,然后必须 chown 许多 /usr/local 文件夹,并且不认为这是一个好主意。也许对于酿造文件夹来说这很好,但对于其他东西则不然。

如何安装 R 并使其正常工作?

小智 9

可能是权限的问题。根据上面给出的日志,我认为关键点是/usr/local/Cellar/子/父目录的权限。检查权限也许有帮助。

要更新权限(如果需要),请使用命令:

sudo chown -R ${USER}:staff /usr/local/Cellar/

  • 我必须使用以下命令更改文件夹的权限:“sudo chown -R ${USER}:staff /usr/local/Cellar/”,因为我从之前错误的 Homebrew 安装中获得了混合权限。我使用的是 Mac OS X (Mojave) (4认同)

hhh*_*hhh 7

正如艾登肖所评论的:

sudo chown -R ${USER}:staff /usr/local/Cellar/
Run Code Online (Sandbox Code Playgroud)

这也为我解决了安装错误后的问题。