Tried installing MongoDB with brew and it says "Error: Permission denied - (mongod.conf, / usr / local / etc / mongod.conf)"

Using Mac OSX 10.10.4 on a 13 'Macbook Air

Typed in 'brew update' as Mongo docs said and it updated Then typed in 'brew install mongodb' and it took a long time to say

Error: Permission denied - (mongod.conf, /usr/local/etc/mongod.conf)

      

Here's what the console to this point says, in case it helps:

Joshuas-Air:~ Josh$ brew install mongodb
==> Downloading https://homebrew.bintray.com/bottles/mongodb-3.0.4.yosemite.bottle.tar.gz
######################################################################## 100.0%
==> Pouring mongodb-3.0.4.yosemite.bottle.tar.gz
Error: Permission denied - /usr/local/etc/mongod.conf
Warning: Bottle installation failed: building from source.
==> Installing mongodb dependency: scons
==> Downloading https://homebrew.bintray.com/bottles/scons-2.3.5.yosemite.bottle.tar.gz
######################################################################## 100.0%
==> Pouring scons-2.3.5.yosemite.bottle.tar.gz
🍺  /usr/local/Cellar/scons/2.3.5: 208 files, 2.4M
==> Downloading https://fastdl.mongodb.org/src/mongodb-src-r3.0.4.tar.gz
######################################################################## 100.0%
==> Cloning https://github.com/mongodb/mongo-tools.git
Updating /Library/Caches/Homebrew/mongodb--github.com-mongodb-mongo-tools--git
==> Checking out tag r3.0.4
==> ./build.sh
==> /usr/local/opt/scons/bin/scons install --prefix=/usr/local/Cellar/mongodb/3.0.4 -j4 --osx-version-min=10.10 --cc=/usr/bin/clang --cxx=/usr/bin/clang++ --use-new-tools
Error: Permission denied - (mongod.conf, /usr/local/etc/mongod.conf)
Joshuas-Air:~ Josh$ 

      

Any help would be generally appreciated.

+3


source to share


3 answers


I am assuming that the permissions on the / usr / local / folder are not set to 755 or 777. You can change the permissions or just try to run the command as root:



sudo brew install mongodb

      

+1


source


I had the same problem, changing directory permissions didn't work for me, so I ended up finding this solution:



  • Download the most recent version ( .tgz

    ).
  • Open terminal and navigate to folder ~/Downloads

    or wherever you save the file.
  • Untar: tar xvf filename.tgz

    .
  • Enter the directory and change to the directory bin

    .
  • On a terminal, use the command sudo bash

    (become root).
  • Now enter the command cp * /usr/local/bin

    .
  • Create directories /data/db

    (optional, this is the default for MongoDB).
  • On a terminal, use the command exit

    to log out of the root user.
  • which mongo

    should now respond with help /usr/local/bin

    and you are all ready to go.
+2


source


I had basically the same error. I could not solve this problem by executing the / usr / local directories as the hints suggest it might be possible due to my upgrade to High Sierra. I was able to successfully install mongodb by reinstalling homebrew using the following command:

$ /usr/bin/ruby -e "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install)"

This allowed me to use my next one brew install mongodb

.

0


source







All Articles