Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Installing MongoDB

I get this error when installing MongoDB on OSX, even though the second time I tried it with sudo command. Any thought?

==> Checking out tag r3.0.3
==> ./build.sh
==> /usr/local/opt/scons/bin/scons install --prefix=/usr/local/Cellar/mongodb/3.0.3 -j4 --osx-version-min=10.9 --cc=/usr/bin/clang --cxx=/usr/bin/clang++ --use-new-tools
Error: Permission denied - /usr/local/var/mongodb
Monas-MacBook-Pro:meanio mona$ sudo brew install mongodb
Password:
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.
like image 399
Mona Jalal Avatar asked Jun 06 '15 02:06

Mona Jalal


2 Answers

It's a permissions problem. The solution being:

sudo chown -R `whoami` /usr/local/var/mongodb

Per the comment:

Try creating the directory, prior to setting ownership:

sudo mkdir /usr/local/var/mongodb && sudo chown -R `whoami` /usr/local/var/mongodb
like image 50
hd1 Avatar answered Sep 25 '22 03:09

hd1


I just open /usr/local/ via finder and manually create folder with name var. Mac asked for a password. After that I successfully install MongoDB.

like image 33
Cypher Avatar answered Sep 22 '22 03:09

Cypher