Brew install R: Permission denied

6,116

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.

Solution 2

As Edenshaw commented:

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

which solved the problem also for me after bad installation.

Share:
6,116

Related videos on Youtube

SPRBRN
Author by

SPRBRN

Updated on September 18, 2022

Comments

  • SPRBRN
    SPRBRN over 1 year

    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?

  • Edenshaw
    Edenshaw over 4 years
    I had to change the permission on the folder with this command: sudo chown -R ${USER}:staff /usr/local/Cellar/ because I had mix permissions from a previous bad Homebrew installation. I was on a Mac OS X (Mojave)