10
$ 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.

kyletaylored
  • 719
  • 1
  • 7
  • 16
  • You don't `chown` system directories. You probably wanted to say `sudo brew install fontconfig`. – devnull Jul 01 '13 at 04:44
  • 5
    Homebrew doesn't want you use `sudo` when performing actions. ie `Error: Cowardly refusing to 'sudo brew install' You can use brew with sudo, but only if the brew executable is owned by root. However, this is both not recommended and completely unsupported so do so at your own risk.` – kyletaylored Jul 01 '13 at 04:49
  • Try using Disk Doctor to fix folder permissions – Ast Derek Jul 01 '13 at 04:51
  • 2
    possible duplicate of [Homebrew install issues](http://stackoverflow.com/questions/14616981/homebrew-install-issues) – trojanfoe Jul 01 '13 at 06:25

2 Answers2

23

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
kyletaylored
  • 719
  • 1
  • 7
  • 16
2

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!

ph1ash
  • 371
  • 3
  • 13
  • 2
    This is a good solution, but unsafe! See http://stackoverflow.com/questions/16432071/how-to-fix-homebrew-permissions – redolent Oct 12 '15 at 19:10
  • 1
    @redolent - Very good point. I do agree! Unfortunately, it seems like brew is looking for this (from the link you posted) - "`it may be insane but it is what brew itself suggests: $ brew update Error: The /usr/local directory is not writable. Even if this directory was writable when you installed Homebrew, other software may change permissions on this directory. Some versions of the "InstantOn" component of Airfoil are known to do this. You should probably change the ownership and permissions of /usr/local back to your user account. sudo chown -R $(whoami):admin /usr/local`" – ph1ash Oct 22 '15 at 00:53
  • So essentially brew _wants_ the permissions that way? – redolent Oct 22 '15 at 20:49