Homebrew install permissions issue

蓝咒 提交于 2019-11-28 16:59:30

You somehow have limited permissions to /usr/local/Cellar. Brew doesn't like to install with sudo which is why it refuses.

Check the permissions:

ls -ld /usr/local/Cellar

Open them up for writing:

sudo chmod a+w /usr/local/Cellar

Do not use sudo when working with brew (for security reasons).

You've to simple set-up your permissions.

So I would go even further and change the permissions to:

sudo chgrp -R admin /usr/local /Library/Caches/Homebrew
sudo chmod -R g+w /usr/local /Library/Caches/Homebrew

and then apply the specific group (either admin or staff) to user which should be allowed to use brew command. Check groups of your user via: id -Gn).

If there are further issues, run: brew doctor to see what's wrong.

Aiden Bell

I'd change the group permissions:

$ chgrp -R admin /usr/local/Cellar
$ chmod g+w /usr/local/Cellar

assuming your user account is in group admin.

This also happens if you have multiple users on your machine. If so, it would be best for you to change the user since every other approach would have you messing around with a lot more files and folders than just /usr/local/Cellar

Use su userWhoInstalledBrew.

The problem can be solved by changing the directory's owner to the current user:

sudo chown -R $USER /usr/local

This answer is taken from: https://github.com/Homebrew/homebrew/issues/17884

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!