Today I tried to install mongodb via MacPorts on Mac OS X Lion. I got this error message:
Error: Target org.macports.build returned: shell command failed (see log for details) Log for mongodb is at: /opt/local/var/macports/logs/_opt_local_var_macports_sources_rsync.macports.org_release_ports_databases_mongodb/mongodb/main.log Error: Status 1 encountered during processing. To report a bug, see <http://guide.macports.org/#project.tickets>
Maybe it is not the best idea to install MongoDB via MacPorts. I just downloaded the compiled binarys from the MongoDB Homepage: http://www.mongodb.org/downloads. Just unzip it and that’s it.
No you have to create a directory.
mkdir /data cd /data mkdir db
MongoDB expects that this directory exists and puts all necessary DB files into this directory.
Navigate in the command line to the unpacked directory and execute this command as root to start the MongoDB server:
./bin/mongod
And the server is running 🙂
In another shell you can start the client. The client can run without root rights.
./bin/mongo
Now you can start to work
> db.foo.save( { a : 1 } ) > db.foo.find()
Here is a work around to get mongodb to install in MacPorts:
sudo port install mongodb configure.cc=/usr/bin/gcc configure.cpp=/usr/bin/cpp configure.cxx=/usr/bin/g++
What file permissions is recommended for /data/db? What directory did you put the mongo-distribution in?
Thanks
That is up to you. By default it is running under root. And nobody else should write or execute it. But you can also create a mongo user and execute the mongo service as mongo user.
Self downloaded and installed software is usually under /opt. For example /opt/mongo.
Awesome! Thanks a lot! you saved a lot of pain. after I got into the bug https://trac.macports.org/ticket/35118, your post saved me! 🙂
This really answered my downside, thanks
You are welcome. Always happy to help 🙂