In this tutorial I am going to talk about how you can install MongoDB on MacOS in an easy way. I have gone through many tutorials online, but I have been really upset with those tutorials. Most of the tutorials are outdated and old. So I decided to create this tutorial in which i can show you a better and easy way to setup MongoDB on MacOS.
Installing MongoDB on Mac (Catalina and non-Catalina) Updated steps to install MongoDB on a Mac. I had to reconfigure my Macbook.
Install MongoDB on MacOS using Homebrew
- Mac version Catalina made the root folder is no longer writable. Brew has an updated version of mongodb to use a new path (which it creates itself), /usr/local/var/mongodb and following these instructions will fix the issue: Guide to installing updated mongodb-community-edition. Brew install email protected where the first VERSION with the.
- However, if you are using latest Mac version Catalina then the root folder is no longer writable. Brew has an updated version of mongodb to use a new path (which it creates itself), /usr/local/var/mongodb and following these instructions will fix the issue: Follow the link to install and update mongodb-community-edition.
- วิธีติดตั้ง MongoDB บน Mac (Catalina) คำแนะนำสั้น ๆ ในการติดตั้งและตั้งค่า MongoDB.
In order to install MongoDB on MacOs, I would suggest using Homebrew.
Please open up the MacOs command line tool and paste the following command to setup MongoDB on MacOS.
Once you entered the given above command, your MacOS terminal will start some process. Those processes are nothing but related to creating some folder in your local machine where all the Homebrew related settings are kept.
After finishing the installation process, check your Homebrew dependencies.
Hit the below commands to install MongoDB
After MongoDB successfully installed in your machine, then create a folder to store MongoDB data using given below command
Use the given below command to assign the proper permission to MongoDB data folder.
We’ve successfully installed the MongoDB on MacOS also assigned the proper permission. Now it’s time to run mongo daemon service. This service makes the connection and performs the task in the background. Hit the following command to run MongoDB.
Now your apps are all set to communicate with MongoDB. Mongo is correctly working in the background with the help of mongo daemon. You might also check which MongoDB version you are working on, just hit the below command in the terminal.
mongo --version output
Above command will tell you which MongoDB version is running in your local machine. Using the latest version has always been a good practice. It protects you from compatibility chaos with client-side app.
However, if you are using latest Mac version Catalina then the root folder is no longer writable.
Brew has an updated version of mongodb
to use a new path (which it creates itself), /usr/local/var/mongodb and following these instructions will fix the issue:
Follow the link to install and update mongodb-community-edition
This article shows how to install Maven (3.6.3) on macOS Big Sur (version 11.1).
Topics
Related Articles
1. Homebrew install Maven on macOS
1.1 Install Homebrew, a package manager on macOS.
How To Install Mongodb On A Mac
1.2 The command brew install maven
will install the latest Maven.
1.3 Done. The Maven is installed on macOS.
P.S At the time of writing, the latest Maven version is 3.6.3
1.4 Where does Homebrew installed the Maven?
The brew
will install the Maven packages at /usr/local/Cellar/maven/${version}
The brew
also creates shortcut or symbolic links at /usr/local/opt/maven/
1.5 Where does Homebrew put the Maven configuration file, settings.xml
?
The settings.xml
is available at /usr/local/opt/maven/libexec/conf
1.6 Where does Homebrew put the core mvn
executable file?
The mvn
is at /usr/local/bin/
1.7 brew info maven
to show the detail of the Maven package.
1.8 brew list maven
1.9 Useful commands:
brew upgrade maven
to upgrade Maven.brew uninstall maven
to uninstall Maven.
2. Install Maven Manually
If Homebrew failed you or you don’t want the black-box magic, try to install the Maven manually.
2.1 Download the Maven, for example apache-maven-3.6.3-bin.tar.gz
2.2 The below command extracts the downloaded .tar.gz
file to the current user’s home directory ~
2.3 Now, the Maven folder is at this path /Users/mkyong/apache-maven-3.6.3
2.4 On macOS 10.5 Catalina or later, the default shell is zsh, and we can create the environment variables MAVEN_HOME
and update the PATH
in ~/.zshenv
.
Open the ~/.zshenv
and append the following content.
Note
For macOS 10.14 Mojave and before, the default Terminal shell is bash
, and we can create the environment variables in ~/.bash_profile
.
Open the ~/.bash_profile
and append the following content.
P.S Read this Zsh Startup Files.
2.5 Source the ~/.zshenv
to reflect the changes.
2.6 Verification.
Done.