Mac OS 安装 Homebrew 和 MongoDB

2011-11-17 Jerry 开发

Homebrew

Homebrew 是一个简单方便的能够在 Apple Mac OS X 下安装 Unix 工具的程序。

安装方式比较简单,只需要在终端下直接输入:

jerry-mac:~ jerry$ /usr/bin/ruby -e "$(curl -fsSL https://raw.github.com/gist/323731)"

但是,由于权限的问题,可能会提示问题:

-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

调整目录的读写权限:

$ 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

创建数据目录,更改权限:

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 }

标签: Mac MongoDB


发表评论:

Powered by emlog sitemap