If someone can provide some insights here I would GREATLY appreciate it.
I am new to MongoDB, and (relatively) new to the command line.
I had a express/nod
Nothing less likely to be outdated that the official docs: https://docs.mongodb.com/manual/tutorial/install-mongodb-on-os-x/
Updated answer (9/2/2019):
Homebrew has removed mongodb formula from its core repository, see this pull request.
The new way to install mongodb using Homebrew is as follows:
~> brew tap mongodb/brew
~> brew install mongodb-community
After installation you can start the mongodb service by following the caveats:
~> brew info mongodb-community
mongodb/brew/mongodb-community: stable 4.2.0
High-performance, schema-free, document-oriented database
https://www.mongodb.com/
Not installed
From: https://github.com/mongodb/homebrew-brew/blob/master/Formula/mongodb-community.rb
==> Caveats
To have launchd start mongodb/brew/mongodb-community now and restart at login:
brew services start mongodb/brew/mongodb-community
Or, if you don't want/need a background service you can just run:
mongod --config /usr/local/etc/mongod.conf
Deprecated answer (8/27/2019):
I assume you are using Homebrew. You can see the additional information that you need using brew info $FORMULA
~> brew info mongo 255
mongodb: stable 2.4.6, devel 2.5.1
http://www.mongodb.org/
/usr/local/Cellar/mongodb/2.4.5-x86_64 (20 files, 287M) *
Built from source
From: https://github.com/mxcl/homebrew/commits/master/Library/Formula/mongodb.rb
==> Caveats
To reload mongodb after an upgrade:
launchctl unload ~/Library/LaunchAgents/homebrew.mxcl.mongodb.plist
launchctl load ~/Library/LaunchAgents/homebrew.mxcl.mongodb.plist
Caveats is what you need to follow after installation.
additionally you may want mongo to run on another port, then paste this command on terminal,
mongod --dbpath /data/db/ --port 27018
where 27018 is the port we want mongo to run on
/usr/local/bin/
for mac ( which would be if you installed with brew), otherwise you'd need to navigate to the path where mongo is installed/data/db/
existsMake sure you are logged in as root user in your terminal.
Steps to start mongodb server in your mac
sudo su
mongod
Hope it helps you. Thanks
Assuming you have created the data/db directory under bin after install.
<mongodb-install-directory>/bin
directoryRun the command
./mongod
Start a terminal for your mongo shell
<mongodb-install-directory>/bin
directoryRun the command (make sure you put the name of the database)
./mongo test
If you have installed mongodb through homebrew
then you can simply start mongodb through
brew services start mongodb
Then access the shell by
mongo
You can shut down your db by
brew services stop mongodb
You can restart your db by
brew services restart mongodb
For more options
brew info mongodb