mongoDBをOSX(Mac OS)にインストールして動かすまで
Install MongoDB Community Edition on OS X — Getting Started With MongoDB 3.0.4
結局これ読めば良えやんって話なんですけど,brewでインストールした後で色々やらないといけなかったので,日本語でメモしておく.
brew update brew install mongodb
ここまでは良いんだけど,問題はこっからなんですよぉ.
Before you start MongoDB for the first time, create the directory to which the mongod process will write data. By default, the mongod process uses the /data/db directory. If you create a directory other than this one, you must specify that directory in the dbpath option when starting the mongod process later in this procedure.
デフォルトで動くもんだと思ったら動かなかったんですけど,要するにディレクトリを作らないといけなかったっぽいです.ので,自分でディレクトリ作ってそこを使うように指定します.ついでにパーミッションを変更しろと書いてあったので,変更します.というか,冷静に考えたらプロジェクトごとにディレクトリ作ってそこにデータベース作るべきだったのでは感が…….素人なのでお察しください.
※ 別ブログを参照しながらやったので公式のコマンドと相違しています.ひょっとしたら公式のコマンド打ち込んだほうが楽かもしれません.
sudo mkdir /var/db/mongo sudo chmod 777 /var/db/mongo
このあと,作ったディレクトリを指定してmongoDBを起動します.
mongod --dbpath /var/db/mongo
これでおしまいです.お疲れ様でした.