1. Download the compressed package and unzip it to any local directory. (Mine is Documents/develop/mongodb)
2. Create a new Data folder under MongoDB and create a new DB folder under Data. (Bin and Data folder at level one)
3. Enter the bin folder and set the address variable where the database data is stored
CD Documents/develop/mongodb/bin
./mongod--dbpath/users/wangming/documents/develop/mongodb/data/db
The following prompt appears
2014-09-24t09:26:11.776+0800 [Initandlisten] MongoDB starting:pid=1229 port=27017 dbpath=/users/wangming/documents/ develop/mongodb/data/db 64-bit host=wangmingdemacbook-pro.local2014-09-24t09:26:11.776+0800 [Initandlisten] 2014-09-24t09:26:11.776+0800 [Initandlisten] * * warning:soft rlimits too low. Number of files is a, should be at least 10002014-09-24t09:26:11.776+0800 [Initandlisten] DB version v2.6.42014-09-24t09 : 26:11.776+0800 [Initandlisten] git version:3a830be0eb92d772aa855ebb711ac91d658ee9102014-09-24t09:26:11.777+0800 [ Initandlisten] Build Info:darwin bs-osx108-4 12.5.0 Darwin Kernel Version 12.5.0:sun Sep 13:33:47 PDT 2013; root:xnu-2050.48.12~1/release_x86_64 x86_64 boost_lib_version=1_492014-09-24t09:26:11.777+0800 [Initandlisten] allocator:system2014-09-24t09:26:11.777+0800 [Initandlisten] options: {storage: {dbPath: "/users/wangming/documents /develop/mongodb/data/db "}}2014-09-24t09:26:11.785+0800 [Initandlisten] Journal dir=/users/wangming/documents/ Develop/mongodb/data/db/journal2014-09-24t09:26:11.785+0800 [Initandlisten] recover:no journal files present, no recovery needed2014-09-24t09:26:11.800+0800 [Fileallocator] Allocating new datafile/users/wangming/documents/develop/ MONGODB/DATA/DB/LOCAL.NS, filling with zeroes ... 2014-09-24t09:26:11.800+0800 [Fileallocator] Creating directory/users/wangming/documents/develop/mongodb/data/db/ _tmp2014-09-24t09:26:11.829+0800 [Fileallocator] Done allocating datafile/users/wangming/documents/develop/mongodb /data/db/local.ns, SIZE:16MB, took 0.029 secs2014-09-24t09:26:11.899+0800 [fileallocator] Allocating new Datafile/user s/wangming/documents/develop/mongodb/data/db/local.0, filling with zeroes ... 2014-09-24t09:26:12.075+0800 [Fileallocator] Done allocating datafile/users/wangming/documents/develop/mongodb/ data/db/local.0, SIZE:64MB, took 0.176 secs2014-09-24t09:26:12.193+0800 [Initandlisten] Build index on:local.startup_l OG properties: {v:1, key: {_id:1}, Name: "_id_", NS: "Local."Startup_log "}2014-09-24t09:26:12.194+0800 [Initandlisten] added index to empty collection2014-09-24t09:26:12.194+ 0800 [initandlisten] command Local. $cmd command:create {create: "Startup_log", size:10485760, capped:true} ntoreturn: 1 keyupdates:0 numyields:0 reslen:37 394ms2014-09-24t09:26:12.194+0800 [Initandlisten] waiting for connections on port 27 0172014-09-24t09:26:23.841+0800 [Initandlisten] connection accepted from 127.0.0.1:50778 #1 (1 connection now OPEN) 2014-09-24t09:26:23.841+0800 [conn1] End connection 127.0.0.1:50778 (0 connections now OPEN) 2014-09-24t09:26:23.994+ 0800 [Initandlisten] connection accepted from 127.0.0.1:50780 #2 (1 connection now OPEN) 2014-09-24t09:26:23.994+0800 [con N2] End Connection 127.0.0.1:50780 (0 connections now OPEN) 2014-09-24t09:27:11.814+0800 [Clientcursormon] Mem (MB) res:33 virt:26532014-09-24t09:27:11.814+0800 [Clientcursormon] Mapped (incl Journal view): 1602014-09-24t09:27:11.814+0800 [ Clientcursormon] Connections:02014-09-24t09:28:13.996+0800 [Initandlisten] connection accepted from 127.0.0.1:50789 #3 (1 connection now OPEN) 2014-09-24t09:32:11.887+ 0800 [Clientcursormon] Mem (MB) res:33 virt:26532014-09-24t09:32:11.887+0800 [Clientcursormon] Mapped (incl Journal View ): 1602014-09-24t09:32:11.887+0800 [Clientcursormon] connections:12014-09-24t09:37:11.960+0800 [Clientcursormon] Mem (MB) res:33 virt:26532014-09-24t09:37:11.960+0800 [Clientcursormon] Mapped (incl Journal view): 1602014-09-24t09 : 37:11.960+0800 [Clientcursormon] Connections:1
4.COMMAND+T Create a new terminal window and enter the./mongo command under the bin file.
MongoDB Shell version:2.6.4connecting to:testwelcome to the MongoDB shell. For interactive help, type ' help '. For more comprehensive documentation, seehttp://docs.mongodb.org/questions? Try the support Grouphttp://groups.google.com/group/mongodb-userserver have startup warnings:2014-09-24t09:26:11.776+ 0800 [Initandlisten] 2014-09-24t09:26:11.776+0800 [initandlisten] * * warning:soft rlimits too low. Number of files is a, should be at least 1000
At this point, OK.
tutorial on installing MongoDB database on Mac