Adding MongoDB to my Mac OS X Snow Leopard Ruby on Rails Environment
November 15, 2010
Tonight I wanted to add MongoDB to my Mac OS X Snow Leopard Ruby on Rails Environment. Refer to my earlier post for details of how I setup my environment. This post assumes your environment is setup according to the instructions found there.
I wrote the following script to handle installation of MongoDB. I decided to grab the pre-built version of MongoDB from the project site and then place the files under the /usr/local/ror directory tree.
#!/bin/bash # Get and extract a copy of Mongodb curl http://fastdl.mongodb.org/osx/mongodb-osx-x86_64-1.6.4.tgz > mongodb-osx-x86_64-1.6.4.tgz tar xvf mongodb-osx-x86_64-1.6.4.tgz curl http://downloads.mongodb.org/docs/mongodb-docs-2010-09-23.pdf > mongodb-docs-2010-09-23.pdf # Move files into final locations ( cd mongodb-osx-x86_64-1.6.4 sudo cp -R * /usr/local/ror sudo chmod a+r /usr/local/ror/GNU* /usr/local/ror/README* /usr/local/ror/THIRD* sudo gem install mongo ) ( sudo cp mongodb-docs-2010-09-23.pdf /usr/local/ror/share/doc/mongodb.pdf sudo chmod a+r /usr/local/ror/share/doc/mongodb.pdf )
Download the script tarball (mongodb.sh.tar), extract it into a folder like /tmp and then run sh ./mongodb.sh. This will download the MongoDB binaries and place everything in the /usr/local/ror tree.
One final step. Since you are running on a Mac you might want to check out a cool MongoDB client called MongoHub. You can learn more and download it from the official site.