Travis' article, MongoDB: A first look, came out a few days ago and piqued my interest further. Then Matthew sent me some source code that requires it. The stage was set for getting MongoDB working on my Mac.
I use homebrew as a package manager for installing open source bits and bobs like couchdb, git, and hg. Installing MongoDB was simply a case of:
brew install mongodb
Once, installed there's a convenient LaunchAgent plist supplied so that mongodb starts with the computer:
cp /usr/local/Cellar/mongodb/1.4.3-x86_64/org.mongodb.mongod.plist ~/Library/LaunchAgents
launchctl load -w ~/Library/LaunchAgents/org.mongodb.mongod.plist
And at this point, MongoDB is installed on your Mac and Travis' article and the tutorial work!
The Mongo PHP extension
If you've been following along here for a while, then you'll know that I use the stock PHP that comes with Mac OS X. I've been very happy with it so far and installed Xdebug was easy enough using pecl, so I was hopeful that the mongo extension would be equally simple.
Turns out that it is!
pecl install mongo
Compiles the extension with no problems.
To add it to your PHP install, edit php.ini and add:
A quick sudo apachectl restart and phpinfo() shows this:
All done! You can now get at MongoDB from your PHP scripts.