OS X LionにMongoDBをインストールする方法
HomeBrewで簡単にインストールできるようです。
$ brew search mongodb mongodb adamv/alt/mongodb-dev
$ brew install mongodb ==> Downloading http://fastdl.mongodb.org/osx/mongodb-osx-x86_64-2.0.6.tgz ######################################################################## 100.0% ==> Caveats If this is your first install, automatically load on login with: mkdir -p ~/Library/LaunchAgents cp /usr/local/Cellar/mongodb/2.0.6-x86_64/homebrew.mxcl.mongodb.plist ~/Library/LaunchAgents/ launchctl load -w ~/Library/LaunchAgents/homebrew.mxcl.mongodb.plist If this is an upgrade and you already have the homebrew.mxcl.mongodb.plist loaded: launchctl unload -w ~/Library/LaunchAgents/homebrew.mxcl.mongodb.plist cp /usr/local/Cellar/mongodb/2.0.6-x86_64/homebrew.mxcl.mongodb.plist ~/Library/LaunchAgents/ launchctl load -w ~/Library/LaunchAgents/homebrew.mxcl.mongodb.plist Or start it manually: mongod run --config /usr/local/etc/mongod.conf The launchctl plist above expects the config file to be at /usr/local/etc/mongod.conf. ==> Summary /usr/local/Cellar/mongodb/2.0.6-x86_64: 17 files, 122M, built in 2.6 minutes
自動的に起動させるようにするには、上記の通り設定する必要がありますが、常に起動している必要が無いので、上記コマンドで起動させました。
$ mongod run --config /usr/local/etc/mongod.conf Fri Jun 29 11:31:42 [initandlisten] MongoDB starting : pid=37591 port=27017 dbpath=/usr/local/var/mongodb 64-bit host=*****-no-MacBook-Air.local Fri Jun 29 11:31:42 [initandlisten] db version v2.0.6, pdfile version 4.5 Fri Jun 29 11:31:42 [initandlisten] git version: e1c0cbc25863f6356aa4e31375add7bb49fb05bc Fri Jun 29 11:31:42 [initandlisten] build info: Darwin erh2.10gen.cc 9.8.0 Darwin Kernel Version 9.8.0: Wed Jul 15 16:55:01 PDT 2009; root:xnu-1228.15.4~1/RELEASE_I386 i386 BOOST_LIB_VERSION=1_40 Fri Jun 29 11:31:42 [initandlisten] options: { bind_ip: "127.0.0.1", command: [ "run" ], config: "/usr/local/etc/mongod.conf", dbpath: "/usr/local/var/mongodb" } Fri Jun 29 11:31:42 [initandlisten] journal dir=/usr/local/var/mongodb/journal Fri Jun 29 11:31:42 [initandlisten] recover : no journal files present, no recovery needed Fri Jun 29 11:31:42 [websvr] admin web console waiting for connections on port 28017 Fri Jun 29 11:31:42 [initandlisten] waiting for connections on port 27017