MacOS|MacOS 安装MongoDB

安装 1. Update Homebrew’s package database. brew update
2. Install MongoDB 【MacOS|MacOS 安装MongoDB】brew install mongodb
3. Install the MongoDB Binaries with TLS/SSL Support brew install mongodb --with-openssl

4. Install the Latest Development Release of MongoDB brew install mongodb --devel



运行 1. Create the data directory mkdir -p /data/db

2. Set permissions for the data directory Before running mongod for the first time, ensure that the user account running mongod has read and write permissions for the directory.

3. Run MongoDB mongod

Specify the path of the data directory

If you do not use the default data directory (i.e.,/data/db), specify the path to the data directory using the--dbpath option
mongod --dbpath

参见: https://docs.mongodb.com/manual/tutorial/install-mongodb-on-os-x/

    推荐阅读