When trying to install R via Brew, I get the following output and errors:

==> 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

I'm installing this under an admin account. Via my normal non-admin account I get more trouble, and then have to chown many /usr/local folders, and don't think that's a good idea. Maybe for the brew-folders that is fine, but not for other stuff.

How can I install R and get it working?


Solution 1:

Maybe it is a problem about permission. According to the logs given above, I think the key point is the permission of /usr/local/Cellar/ or the sub/parent directory. Checking the permission maybe help.