Mode one: command line
MongoDB installation has a good variety of installation methods, there are ordinary youth of the homebrew way, but also the source of literary youth compilation method. I just want to quickly put it up and use it, so I'll pick the simplest homebrew.
Please refer to the official documentation: http://docs.mongodb.org/manual/tutorial/install-mongodb-on-os-x/
Update the Homebrew package database and enter it in the Mac Terminal:
$ Brew Update
Then wait patiently, this does not show any, estimated to take a few minutes, depending on the speed of the network. Then you list a whole bunch of things and you can do the next steps.
Start installing MongoDB
$ Brew Install MongoDB
Then continue to wait for MongoDB download to complete. This is more intimate, there is a download progress percentage.
==> Downloading https://downloads.sf.net/project/machomebrew/Bottles/mongodb-2.6
######################################################################## 100%
==> Pouring mongodb-2.6.5.mavericks.bottle.2.tar.gz
==> Caveats
To has launchd start MongoDB at login:
Ln-sfv/usr/local/opt/mongodb/*.plist ~/library/launchagents
Then to the load MongoDB now:
Launchctl Load ~/library/launchagents/homebrew.mxcl.mongodb.plist
Or, if you don ' t want/need launchctl, you can just run:
Mongod-config/usr/local/etc/mongod.conf
==> Summary
?? /usr/local/cellar/mongodb/2.6.5:17 files, 331M
Dus-macbook-pro:countmeinserver dudaniel$
Start MongoDB
The last hint above is the way to start MongoDB directly.
Mongod-config/usr/local/etc/mongod.conf
To connect to MongoDB, you can use the command line tool to MONGO the connection:
$ MONGO
MongoDB Shell version:2.6.5
Connecting To:test
Welcome to the MongoDB shell.
For interactive help, type ' help '.
For more comprehensive documentation, see
http://docs.mongodb.org/
Questions? Try the Support group
Http://groups.google.com/group/mongodb-user
The directory of MongoDB installed in this way is in the following location:
Mode two: How to download the installation package
Mongodb:https://www.mongodb.com/download-center?jmp=nav#community
nodejs:https://nodejs.org/en/
In this paper, the key record is to install MongoDB under Mac and cooperate with Nodejs to realize simple adding and deleting operation.
Native environment: System =>mac OS 10.12
nodejs=>6.9.0
mongodb=>3.2.5
1. Download Nodejs, all the way next after the installation is complete, the terminal input NODE-V has the display version number on behalf of the installation success, other abnormal situation this article does not introduce;
2. After downloading MongoDB, copy mongodb-3.2.5.tar.gz to/usr/local path to extract the MongoDB folder, (in which I changed my name and deleted the version number)
* By default in the Finder is not see/usr this directory (the terminal is used to skip), you can open the Finder and then press SHIFT + Command +g enter/usr/local after the return to see this hidden directory
3. The display of my native directory structure, under the/usr/local/mongodb/bin is the implementation of MongoDB files
4. Then create a new data folder in the root directory, and then build a DB folder, that is, in the USR folder above the data folder, which is used to store the database,
5. The terminal switches to the/usr/local/mongodb/bin directory,
6. Execute./mongod Start server
7. Display the interface waiting for client connection on behalf of the success of the boot, if not successful check your/data/db folder location right, no, you can delete the build one,
8. Open the browser and enter localhost:27017.
It looks like you is trying to access MongoDB over HTTP on the native driver port.
"Such a line of text, then can reopen a terminal is also/usr/local/mongodb/bin this directory input./mongo command to connect
9. The prompt indicates that the connection is successful, the terminal will always display a ' > ' symbol, you can enter MongoDB SQL command now
Install MongoDB under Mac