This guide helps you to install MongoDB in macOS. This is just a 2 minutes step by step guide.
To make your task easy if have also created one video. You can find video link for MongoDB installation in Mac Os in the last of this article.
Step by step guide to install MongoDB in MacOS
Now lets start installation of MongoDB in Mac Os. Please read this article till end to learn MongoDB installation.
Once you completed this article you should be able to –
- Do MongoDB installation in macOS
- Start MongoDB services in macOS
- Stop MongoDB services in macOS
Before you start MongoDB installation please open terminal in your mac.
Now please find the commands used for MongoDB installation in macOS.
- First run “cd~”. It will point you to the root directory.
- Now run “brew update”. It will update brew libraries in your system.
- Install xcode by running “xcode-select –install”. It will install xcode in your system. In case xcode is already present. It will just update it.
- Tap brew to MongoDB. For doing this you need to run “brew tap mongodb/brew”.
- We recommend to install node before you start installing MongoDB. Run “brew install node”.
- Now run this command – “brew install [email protected]”. This is the game changer command. It will install MongoDB in your system. Once you run this command it takes 10-15 seconds to complete.
- Afterwards please install MongoDB tools – “brew install mongodb-database-tools”.
- Once MongoDB tools installed please run – “brew services start [email protected]”.
- Once MongoDB services starts, open MongoDB shell by executing this command – “mongosh”.
- Now you may be intereted to see list of databases. MongoDB command to display list of all databases – “show dbs”.
- Command to close MongoDB shell – “quit()”.
- Next step is to verify MongoDB installation files. Change the directory to “cd /usr/local/bin”.
- Now type “ls” command to see the list of files inside bin folder.
- Hope you are able to see all the installed MongoDB files.
- Now you can stop MongoDB services. Run “brew services stop [email protected]”. You can stop mongodb server using this command.
So friends hope you enjoyed this video. Now you are able to install MongoDB in macOS operating systems.
Please find YouTube guide to install MongoDB services in macOS.
Moreover, You can find a very good reference on official website of MongoDB to learn installation.
Thanks for reading this article. So you are able to install MongoDB in your Mac system. Also you should be able to strat and stop MongoDB services. You can use MacOS terminal for this purpose.
In case yu are facing any issue please drop a comment so that we can support you.