Installing MongoDB community Edition on macOS
For macOS running Intel processors.
MongoDB community server is a free version of MongoDB. To install MongoDB in macOS there are 2 options available. One is by manually downloading .tgz Tarball and the other using the brew package manager. Using brew package manager is easy and it is recommended by the official MongoDB documentation as well. Here I am using macOS running Intel processors therefore if you are using macOS running on Apple M1 processor some of the steps may not be working for you. Threfore you can use the official documentation to install and setup.
In this post we will install MongoDB using the brew package manger. For that you must have installed Homebrew first. Homebrew is terminal package manager for macOS. You can download Homebrew by going through following link.
You can just copy and paste the terminal command and hit enter.
Then it will ask you to enter the system password. Just type the password and again enter.
In some case it asks to press return to continue. You can continue by pressing return.
After successfully installing it should show installation successful.
Now it is time to install MongoDB.
You can install MongoDB community edition by going to following link as well.
To install latest version of MongoDB you can go through above link. If you can stick with version 4.4 you can follw the steps.
Now open the terminal again and run the following command.
brew tap mongodb/brew
This will tap mongodb/brew. Then run the following command in the terminal.
brew install mongodb-community@4.4
It may take some time to install.
After installing you should see something like above. To confirm your download you can use, mongod — version on your terminal to check the version of you download.
After the download you can start the MongoDB as macOS service by the following command.
brew services start mongodb-community@4.4
This will start MongoDb server.
Here, the version may change according to your date of download.
Then you can stop MongoDB running in macOS by using below command.
brew services stop mongodb-community@4.4
If you have started MongoDB as macOS service you can verify that MOngoDB is running by following command.
brew services list
To be continued.