Open In App

How to Install MongoDB Enterprise on MacOS?

Last Updated : 13 Nov, 2022
Comments
Improve
Suggest changes
Like Article
Like
Report

In complement to SQL, MongoDB is a document database that is part of the NoSQL family of databases. Records in MongoDB are documents, which in JavaScript behave quite similarly to JSON objects. By using the field's key, values in documents can be sought. Because some fields/keys might be present in documents but not others, Mongo is incredibly flexible. This contrasts with SQL databases like MySQL and PostgreSQL, where individual records correspond to rows and fields to tables in the tables. Throughout this article, we'll look at how to install MongoDB on Mac OS. MongoDB is a popular open-source document database and NoSQL database. 10gen is the company there next to MongoDB.

Installing MongoDB Enterprise in MacOS

Step 1: Download the MongoDB .tgz file. Visit the official MongoDB website and download the.tgz file from the community section.

Downloading-mongoDB-file
 

Now, in a terminal, extract the downloaded.tgz file and mv the mongo directory to /usr/local/MongoDB.

Step 2: Create a MongoDB Data directory. By default, MongoDB stores data in the /data/DB directory, so we must create this directory and assign proper permissions with the chown command. Run the following command from the terminal.

Creating-mongoDB-data-directory
 

Step 3: To set MongoDB/bin PATH to ~/.bash_profile. In order for the mongo and MongoDB commands to be recognized from the terminal, we now need to set the environment variable for MongoDB. The MongoDB/bin path must be added to the /.bash profile file in order to accomplish that.

Setting-mongoDB-path
 

Step 4: Start MongoDB. We must first launch the MongoDB command, which runs the mongo daemon, in order to interact with MongoDB. Consequently, open two distinct terminals. 

Starting-mongoDB
 

Next Article

Similar Reads