作者:Jerry 發(fā)布于:2011-11-17 14:12 Thursday 分類:開發(fā)
Homebrew
Homebrew 是一個簡單方便的能夠在 Apple Mac OS X 下安裝 Unix 工具的程序。
安裝方式比較簡單,只需要在終端下直接輸入:
jerry-mac:~ jerry$ /usr/bin/ruby -e "$(curl -fsSL https://raw.github.com/gist/323731)"
但是,由于權(quán)限的問題,可能會提示問題:
-e:66: warning: Insecure world writable dir /usr/local/bin in PATH, mode 040766
-e:77: warning: Insecure world writable dir /usr/local/bin in PATH, mode 040766
調(diào)整目錄的讀寫權(quán)限:
$ sudo chmod o-w /usr/local/bin
$ sudo chmod o-w /usr/local
重新嘗試,
jerry-mac:~ jerry$ /usr/bin/ruby -e "$(curl -fsSL https://raw.github.com/gist/323731)"
==> This script will install:
/usr/local/bin/brew
/usr/local/Library/Formula/...
/usr/local/Library/Homebrew/...
==> The following directories will be made group writable:
/usr/local/.
/usr/local/bin
==> The following directories will have their group set to admin:
/usr/local/.
/usr/local/bin
Press enter to continue
==> /usr/bin/sudo /bin/chmod g+rwx /usr/local/. /usr/local/bin
==> /usr/bin/sudo /usr/bin/chgrp admin /usr/local/. /usr/local/bin
==> Downloading and Installing Homebrew...
==> Installation successful!
Now type: brew help
安裝成功。
更新軟件庫清單:
jerry-mac:~ jerry$ brew update
Initialized empty Git repository in /usr/local/.git/
remote: Counting objects: 48129, done.
remote: Compressing objects: 100% (21482/21482), done.
remote: Total 48129 (delta 30258), reused 41855 (delta 25975)
Receiving objects: 100% (48129/48129), 6.72 MiB | 170 KiB/s, done.
Resolving deltas: 100% (30258/30258), done.
From https://github.com/mxcl/homebrew
* [new branch] gh-pages -> origin/gh-pages
* [new branch] master -> origin/master
HEAD is now at cbcaa4d gpac: make lowercasing binaries an option
Already up-to-date.
MongoDB
創(chuàng)建數(shù)據(jù)目錄,更改權(quán)限:
jerry-mac:~ jerry$ sudo mkdir -p /data/db/
jerry-mac:~ jerry$ sudo chmod -R 777 /data/db/
方式1:通過 Homebrew 安裝
$ brew install mongodb
方式2:解壓縮安裝包
下載地址:http://www.mongodb.org/downloads
解壓縮安裝包,啟動 MongoDB Server
$ ./mongodb-xxxxxxx/bin/mongod
測試下連接:
jerry-mac:bin jerry$ ./mongo
MongoDB shell version: 2.0.1
connecting to: test
> db.foo.save({a:1})
> db.foo.find()
{ "_id" : ObjectId("4ec48e59b4ce9fde1a0edea3"), "a" : 1 }