Reputation:
I followed the official guide to install mongodb but failed many times. Firstly, I tried to use brew install mongodb
brew --version
Homebrew 1.4.3
brew install mongodb
Error:
Error: Permission denied @ rb_sysopen - /usr/local/var/homebrew/locks/scons.formula.lock
I tried to use sudo
sudo brew install mongodb
Error:
Error: Running Homebrew as root is extremely dangerous and no longer supported.
As Homebrew does not drop privileges on installation you would be giving all
build scripts full access to your system.
I am still trying to download the binaries and extracted through the tar command, but it is more complicated and I encountered many other problems. So I hope to solve this problem firstly... Any ideas? Thanks a lot.
Upvotes: 4
Views: 3159
Reputation: 5825
I got stuck in a bit of a loop with permissions issues. I eventually uninstalled and reinstalled Homebrew and it worked for me. Here's a reference: https://github.com/Homebrew/install
Upvotes: 1
Reputation: 4553
sudo chown -R $USER:admin /usr/local
Update:
Whilst the above solves your issue just fine, there is a much nicer way.
# allow admins to manage homebrew's local install directory
chgrp -R admin /usr/local
chmod -R g+w /usr/local
# allow admins to homebrew's local cache of formulae and source files
chgrp -R admin /Library/Caches/Homebrew
chmod -R g+w /Library/Caches/Homebrew
# if you are using cask then allow admins to manager cask install too
chgrp -R admin /opt/homebrew-cask
chmod -R g+w /opt/homebrew-cask
source: https://gist.github.com/jaibeee/9a4ea6aa9d428bc77925
Upvotes: 5