3

I am a second "Administrator" user on a Mac OS. I am in the admin group, and am trying to use homebrew, which was installed by the first user.

I have made sure everything in /usr/local/* is writable by admin, i.e. sudo chmod -R g+w /usr/local/*.

When trying to run brew install a few different packages, I get a few of these errors

cp: setattrlist: /usr/local/Cellar/[email protected]/.: Permission denied
cp: chmod: /usr/local/Cellar/[email protected]/.: Operation not permitted
Error: Failure while executing; `cp -pR /private/tmp/d20210523-60782-14t7vu8/[email protected]/. /usr/local/Cellar/[email protected]` exited with 1. Here's the output:
cp: setattrlist: /usr/local/Cellar/[email protected]/.: Permission denied
cp: chmod: /usr/local/Cellar/[email protected]/.: Operation not permitted

But upon inspecting, the folder has the permissions I expected

:; ls -al /usr/local/Cellar/icu4c/
total 0
drwxrwxr-x  3 user1 admin   96 May 23 14:06 .
drwxrwxr-x 73 user1 admin 2336 May 23 14:05 ..
drwxrwxr-x 12 user1 admin  384 May 23 14:06 67.1

Does anyone know what I might be missing here?

4
  • What is the output of ls -laed "/usr/local/Cellar/[email protected]"? The -e will display ACL information that may be preventing you from running brew install. Commented Jun 4, 2021 at 9:25
  • -e did not display any additional information from what I could tell Commented Jun 6, 2021 at 22:35
  • Thanks, and what is the output of id? Commented Jun 7, 2021 at 4:57
  • similar situation with multiple macos admin users this worked for me sudo chown -R $(whoami) /usr/local/Cellar/ Commented Apr 16, 2023 at 13:24

1 Answer 1

1

I don't really have an answer, yet I'm facing the same issue, but may be some clues that will help progressing on finding the root cause and may be fix the issue. On my side I'm using ACLs on brew install as I have two admin accounts, but as you are not using ACLs, this means that this is not likely an ACL issue as I thought.

I have a post install script that set ACLs for the admins so that any admin can use brew. Each time I do use brew to install, I do use this script to restore owner and set ACLs

What I know is that the setattrlist and fsetattrlist are about metadata, so finder/spotlight info. I have not found any way with ACLs to get rid off this error cleanly.

I can reproduce it outside of homebrew install if use the same way homebrew performs the copy

for instance $ cp -pR /usr/local/Cellar/webp ~/webp $ cp -pR ~/webp/. /usr/local/Cellar/webp # ⇒ produce a permission error or setattrlist error $ cp -pR ~/webp /usr/local/Cellar/webp # ⇒ does work, so there likely a fix in homebrew to find and remove the /. form the source of cp.

So far when I get this error, I remove the directory from Cellar an restart the brew install command.

tedious when brew is updating a lot of things, but this is the only workaround I found for now.

1
  • While this is, as author states, not a solution, the diagnosis is absolutely correct and the suggested workaround works. I had to completely remove about a half dozen directories in /opt/homebrew/Cellar/ before I was able to install. Commonly used shared tooling like ca-certificates, readline, c-ares are often going to have to be removed and re-installed. Commented Mar 9, 2022 at 18:57

You must log in to answer this question.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.