brew install - permission denied (after chown -R `

2019-04-06 03:23发布

$ brew install fontconfig
Error: Permission denied - /Library/Caches/Homebrew/Formula/fontconfig.brewing

$ sudo chown -R `whoami` /usr/local

$ brew install fontconfig
Error: Permission denied - /Library/Caches/Homebrew/Formula/fontconfig.brewing

Not sure where to go from here. Ran brew doctor to fix some existing issues, but can't seem to get past this.

2条回答
一夜七次
2楼-- · 2019-04-06 03:55

trojanfoe's answer helped. There was a permission issue with the Library/Logs folder that I wasn't assigned to, but somehow the Library/Caches/Homebrew folder didn't exist. So I just created that, the subfolder Formula, and changed the permission and everything installed just fine. It actually cleared up a lot of errors I was having.

Thanks everyone.

Update

@fet's one liner works great.

mkdir -p ~/Library/Caches/Homebrew/Formula
查看更多
▲ chillily
3楼-- · 2019-04-06 04:09

For others that are running into the error of something like

$ brew upgrade
==> Upgrading 1 outdated package, with result:
libtool 2.4.6
==> Upgrading libtool
Error: Permission denied - /usr/local/lib/libltdl.7.dylib

Make sure that your directory, in this case /usr/local/lib, has sufficient permissions for you to access it. I ran into the issue where it was only assigned to root:admin.

$ ls -la /usr/local/lib/ | grep "libltdl.7"
lrwxr-xr-x   1 username  admin        43 Oct 12  2014 libltdl.7.dylib -> ../Cellar/libtool/2.4.2/lib/libltdl.7.dylib

Switched that to myusername:admin and was able to upgrade with no problems.

cd /usr/local/lib
sudo chown `whoami`:admin .

Hope that helps!

查看更多
登录 后发表回答