You are using an outdated browser which puts all net citizens at risk. As an incentive to upgrade to a current and thus much more secure product (we recommend the free Firefox browser), you won't be able to visit this site in its cute design, but in this rather boring printer-ready version only. Thank you for considering a browser update!

NoSQL on Mac OS X

NoSQL databases such as MongoDB and Redis have become quite popular especially in the Ruby and Rails ecosystem. If you’re developing on a Mac though, installation can be quite a hassle unless you rely on some package manager. The easiest solution is probably Homebrew, a quite mature installer written in Ruby. However, it lacks many feautures of a real package manager such as versions, slotting and a clean uninstall (which includes dependencies).

This is why I prefer Gentoo Prefix which is powered by Gentoo’s excellent Portage source package manager. Check out my introductory blog post to get a feel for Gentoo Prefix.

MongoDB

MongoDB is not yet part of the official Gentoo Prefix packages repository as of now, but you can still install it from our overlay. Follow the instructions to subscribe to it.

MongoDB defaults to the Spidermonkey JS engine, however, due to some issues with packaging and speed, I prefer Google’s V8 engine – at least for now:

echo "dev-db/mongodb v8" >>$EPREFIX/etc/portage/package.use
echo "dev-lang/v8 **" >>$EPREFIX/etc/portage/package.keywords
emerge -av mongodb

The following aliases come in handy for your daily work with MongoDB:

alias mongo-start="mongod --fork --dbpath \$EPREFIX/var/lib/mongodb --logpath \$EPREFIX/var/log/mongodb.log"
alias mongo-stop="killall -SIGTERM mongod 2>/dev/null"
alias mongo-status="killall -0 mongod 2>/dev/null; if [ \$? -eq 0 ]; then echo 'started'; else echo 'stopped'; fi"

Let’s go ahead and try:

mongo-start
mongo

Redis

The installation for Redis is the usual one-liner:

emerge -av redis

The convenience aliases:

alias redis-start="redis-server \$EPREFIX/etc/redis.conf"
alias redis-stop="killall -SIGTERM redis-server 2>/dev/null"
alias redis-status="killall -0 redis-server 2>/dev/null; if [ \$? -eq 0 ]; then echo 'started'; else echo 'stopped'; fi"

That’s it! Give it a try:

redis-start
redis-cli

(Sven Schwyn)

(We are remaking our web presence and therefore comments are temporary disabled.)