make

まけ

macOS X LionにmongoDBをインストールして動かす

本家のチュートリアルを見ながら進めた。

[kinukawa@Kinukawa-no-MacBook-Air] # brew install mongodb
==> Downloading http://fastdl.mongodb.org/osx/mongodb-osx-x86_64-2.0.3.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.3-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.3-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/Cellar/mongodb/2.0.3-x86_64/mongod.conf

The launchctl plist above expects the config file to be at /usr/local/etc/mongod.conf.
If this is a first install, you can copy one from /usr/local/Cellar/mongodb/2.0.3-x86_64/mongod.conf:
    cp /usr/local/Cellar/mongodb/2.0.3-x86_64/mongod.conf /usr/local/etc/mongod.conf
==> Summary
/usr/local/Cellar/mongodb/2.0.3-x86_64: 18 files, 121M, built in 70 seconds


[kinukawa@Kinukawa-no-MacBook-Air] # which mongo
/usr/local/bin/mongo

[kinukawa@Kinukawa-no-MacBook-Air] # mongo     [/Users/kinukawa/project/node/heroku-node-helloworld]
MongoDB shell version: 2.0.3
connecting to: test
Sat Mar 17 14:04:40 Error: couldn't connect to server 127.0.0.1 shell/mongo.js:84
exception: connect failed

なんかエラーがでた。
気が早かった。
mongodってやつを動かさないとダメみたいなので、チュートリアルをもう一度読みながら進めてみる。

[kinukawa@Kinukawa-no-MacBook-Air] # sudo mkdir -p /data/db/
Password:
[kinukawa@Kinukawa-no-MacBook-Air] # sudo chown `id -u` /data/db

[kinukawa@Kinukawa-no-MacBook-Air] # which mongod
/usr/local/bin/mongod

[kinukawa@Kinukawa-no-MacBook-Air] # mongod   

これでmongodを動かしておいて、

[kinukawa@Kinukawa-no-MacBook-Air] # mongo
MongoDB shell version: 2.0.3
connecting to: test
> 
つながった!