Unser Blog

schönen Freitag!

Fix for homebrew permission denied issues

I came across several homebrew issues where symlinks couldnt be created due to permission denied errors.

TL;DR:
reset permissions to the /usr/local stack.


1) installing and fixing node.JS

brew install node

~ phabi$ brew install node
==> Downloading http://nodejs.org/dist/v0.10.4/node-v0.10.4.tar.gz
Already downloaded: /Library/Caches/Homebrew/node-0.10.4.tar.gz
==> ./configure --prefix=/usr/local/Cellar/node/0.10.4
==> make install
Warning: Could not link node. Unlinking...
Error: The `brew link` step did not complete successfully
The formula built, but is not symlinked into /usr/local
You can try again using `brew link node'
==> Summary
🍺  /usr/local/Cellar/node/0.10.4: 951 files, 14M, built in 73 seconds
2) brew link node
~ phabi$ brew link node
Linking /usr/local/Cellar/node/0.10.4... Warning: Could not link node. Unlinking...

Error: Could not symlink file: /usr/local/Cellar/node/0.10.4/lib/dtrace/node.d
Target /usr/local/lib/dtrace/node.d already exists. You may need to delete it.
To force the link and delete this file, do:
  brew link --overwrite formula_name

To list all files that would be deleted:
  brew link --overwrite --dry-run formula_name
3) brew link --overwrite node
Linking /usr/local/Cellar/node/0.10.4... Warning: Could not link node. Unlinking...

Error: Permission denied - /usr/local/lib/dtrace/node.d
4) sudo chown -R whoami /usr/local

as sudoing homebrew is a bad idea (and doesn't work either) we have to reset the permissions within /usr/local

~ phabi$ sudo chown -R `whoami` /usr/local
Password:
~ phabi$ brew link --overwrite node
Linking /usr/local/Cellar/node/0.10.4... 5 symlinks created

WHOOPS IT WORKS! :-)

5) STEPS

brew update
brew upgrade
brew cleanup
brew install node
brew link --overwrite node
sudo chown -R whoami /usr/local


comments powered by Disqus