Install Mongodb in Mac with Just Few Steps
In My Case I use, brew install mongodb --with-openssl
Install MongoDB.
You can install MongoDB via brew with several different options. Use one of the following operations:
Install the MongoDB Binaries
To install the MongoDB binaries, issue the following command in a system shell:
brew install mongodb
Build MongoDB from Source with TLS/SSL Support
To build MongoDB from the source files and include TLS/SSL support, issue the following from a system shell:
brew install mongodb --with-openssl
Updating Homebrew...
==> Installing dependencies for mongodb: openssl
==> Installing mongodb dependency: openssl
==> Downloading https://homebrew.bintray.com/bottles/openssl-1.0.2k.yosemite.bot
######################################################################## 100.0%
==> Pouring openssl-1.0.2k.yosemite.bottle.tar.gz
==> Using the sandbox
==> Caveats
A CA file has been bootstrapped using certificates from the SystemRoots
keychain. To add additional certificates (e.g. the certificates added in
the System keychain), place .pem files in
/usr/local/etc/openssl/certs
and run
/usr/local/opt/openssl/bin/c_rehash
This formula is keg-only, which means it was not symlinked into /usr/local.
Apple has deprecated use of OpenSSL in favor of its own TLS and crypto libraries
If you need to have this software first in your PATH run:
echo 'export PATH="/usr/local/opt/openssl/bin:$PATH"' >> ~/.bash_profile
For compilers to find this software you may need to set:
LDFLAGS: -L/usr/local/opt/openssl/lib
CPPFLAGS: -I/usr/local/opt/openssl/include
For pkg-config to find this software you may need to set:
PKG_CONFIG_PATH: /usr/local/opt/openssl/lib/pkgconfig
==> Summary
🍺 /usr/local/Cellar/openssl/1.0.2k: 1,696 files, 12M
Warning: mongodb: this formula has no --with-openssl option so it will be ignored
Congratulations, Now Mongodb has been install on Your mac system, for test it without any software, you just need to enter the mongo db path, Here is the path in my case:==> Installing mongodb==> Downloading https://homebrew.bintray.com/bottles/mongodb-3.4.1.yosemite.bott######################################################################## 100.0%==> Pouring mongodb-3.4.1.yosemite.bottle.tar.gz==> CaveatsTo have launchd start mongodb now and restart at login:brew services start mongodbOr, if you don't want/need a background service you can just run:mongod --config /usr/local/etc/mongod.conf==> Summary🍺 /usr/local/Cellar/mongodb/3.4.1: 17 files, 264.5M
==> cd /usr/local/Cellar/mongodb/3.4.1
==> ./mongo
>
Its running now:
for test the mongodb is working or not, just type
> db
test
or Insert some data in mongodb,
> db.data.insert({"username": "sunny"})
WriteResult({ "nInserted" : 1 })
> db.data.find()
{ "_id" : ObjectId("58a438fecfc0a4d46424c721"), "username" : "sunny" }
That's it, data is here. For more Study, follow my blog