DZone
Thanks for visiting DZone today,
Edit Profile
  • Manage Email Subscriptions
  • How to Post to DZone
  • Article Submission Guidelines
Sign Out View Profile
  • Post an Article
  • Manage My Drafts
Over 2 million developers have joined DZone.
Log In / Join
Please enter at least three characters to search
Refcards Trend Reports
Events Video Library
Refcards
Trend Reports

Events

View Events Video Library

Zones

Culture and Methodologies Agile Career Development Methodologies Team Management
Data Engineering AI/ML Big Data Data Databases IoT
Software Design and Architecture Cloud Architecture Containers Integration Microservices Performance Security
Coding Frameworks Java JavaScript Languages Tools
Testing, Deployment, and Maintenance Deployment DevOps and CI/CD Maintenance Monitoring and Observability Testing, Tools, and Frameworks
Culture and Methodologies
Agile Career Development Methodologies Team Management
Data Engineering
AI/ML Big Data Data Databases IoT
Software Design and Architecture
Cloud Architecture Containers Integration Microservices Performance Security
Coding
Frameworks Java JavaScript Languages Tools
Testing, Deployment, and Maintenance
Deployment DevOps and CI/CD Maintenance Monitoring and Observability Testing, Tools, and Frameworks

Modernize your data layer. Learn how to design cloud-native database architectures to meet the evolving demands of AI and GenAI workkloads.

Secure your stack and shape the future! Help dev teams across the globe navigate their software supply chain security challenges.

Releasing software shouldn't be stressful or risky. Learn how to leverage progressive delivery techniques to ensure safer deployments.

Avoid machine learning mistakes and boost model performance! Discover key ML patterns, anti-patterns, data strategies, and more.

Related

  • Loading XML into MongoDB
  • Mastering macOS Client-Server Application Testing: Tools and Key Differences
  • Mastering Secure Connections: A Comprehensive Guide to Accessing Sybase Databases From macOS
  • How You Can Avoid a CrowdStrike Fiasco

Trending

  • Analyzing “java.lang.OutOfMemoryError: Failed to create a thread” Error
  • Beyond ChatGPT, AI Reasoning 2.0: Engineering AI Models With Human-Like Reasoning
  • SQL Server Index Optimization Strategies: Best Practices with Ola Hallengren’s Scripts
  • Platform Engineering for Cloud Teams
  1. DZone
  2. Data Engineering
  3. Databases
  4. Install and Setup MongoDB on Windows or Mac

Install and Setup MongoDB on Windows or Mac

In this article, we will have a quick look at the installation and setup of MongoDB on Windows 11 or MacOS using homebrew.

By 
Vanitha P K user avatar
Vanitha P K
·
Mar. 30, 23 · Tutorial
Likes (1)
Comment
Save
Tweet
Share
3.5K Views

Join the DZone community and get the full member experience.

Join For Free

Windows

Let's look at the steps to download and install MongoDB on Windows.

To install MongoDB in Windows 11, we will download the MongoDB Community .msi installer from the MongoDB community link.

MongoDB Community Server

Step 1: Choose the current latest version in the option and select Windows as Platform. Click on Download.

Step 2: Click the downloaded MongoDB installer. Once the MongoDB setup wizard opens, click Next.

Setup Wizard

Step 3: In the next window, choose the checkbox I accept the terms and click on Next.

Terms and Conditions

Step 4: The Complete setup type installs MongoDB tools to the default location, whereas the Custom type allows us to choose the location of the executables. You can choose either type based on your need and click on Next.

choose setup type

Step 5: Select the Install MongoD as a Service checkbox. By selecting the checkbox we can configure and start MongoDB as a Windows Service during the installation. The MongoDB service executes upon successful installation.

  • Select either Run service as Network Service User or local or domain user.
    • Network Service User is a default Windows user account
    • For the local user, mention the Account domain as period(.) and type the account name and password of the user
    • For the domain user, mention the Account domain, username and password.
  • The default service name is MongoDB. You can change the service name if you already have another service name.
  • Data Directory: db path — If the directory does not exist, it creates the directory.
  • Log Directory:  log path — If the directory does not exist, it creates the directory.

Verify whether all the fields are correct and Click on Next.

Next

To install MongoDB only and not to configure MongoDB as Windows Service, uncheck the Install MongoD as a Service and Click on Next.

Step 6: MongoDB compass is an interactive tool to visualize the database and analyze and view the data changes. To install MongoDB compass with MongoDB, select the Install MongoDB Compass checkbox and Click on Next. It is optional to install MongoDB compass.

Install MongoDB Compass

Step 7: In the next window, Click on Install.

Ready to Install

Status

Step 8: Once the MongoDB installation is complete, Click Finish to exit the wizard.

Click finishMacOS

Prerequisites

To install MongoDB in macOS, we will use the homebrew package manager. To verify whether homebrew is available in your system, run the below command:

 
brew -v


If you have already installed it, you will get a version of homebrew installed. Otherwise, you can install homebrew using the below command.

 
/bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/HEAD/install.sh)"


Homebrew requires Xcode Command line tools for MongoDB installation.

To install Xcode Command line tools, run the below command.

 
xcode-select --install


Choose install in the popup and click on Agree in the agreement wizard.


click on Agree in the agreement wizard

Once you click Agree, the software gets installed.

Downloading Software

MongoDB Installation

Run the following command in the terminal to download the homebrew formula for MongoDB tools.

 
brew tap mongodb/brew


Finally, to install MongoDB run the below command in the macOS terminal.

 
brew install mongodb-community@6.0


The latest MongoDB version supports macOS 10.14 or later.

The MongoDB installation includes the mongod server and the MongoDB shell mongosh.

Verify the installation by typing mongo --version in the new terminal.

MongoDB Compass

To install MongoDB compass, a GUI tool to visualize the database, go to the below link and download it.

  • MongoDB Compass

If you have installed MongoDB Compass, it will look like this when you open it.

You can click on connect and start working on your queries.
You can click on connect and start working on your queries.

MongoDB MacOS Microsoft Windows

Opinions expressed by DZone contributors are their own.

Related

  • Loading XML into MongoDB
  • Mastering macOS Client-Server Application Testing: Tools and Key Differences
  • Mastering Secure Connections: A Comprehensive Guide to Accessing Sybase Databases From macOS
  • How You Can Avoid a CrowdStrike Fiasco

Partner Resources

×

Comments
Oops! Something Went Wrong

The likes didn't load as expected. Please refresh the page and try again.

ABOUT US

  • About DZone
  • Support and feedback
  • Community research
  • Sitemap

ADVERTISE

  • Advertise with DZone

CONTRIBUTE ON DZONE

  • Article Submission Guidelines
  • Become a Contributor
  • Core Program
  • Visit the Writers' Zone

LEGAL

  • Terms of Service
  • Privacy Policy

CONTACT US

  • 3343 Perimeter Hill Drive
  • Suite 100
  • Nashville, TN 37211
  • support@dzone.com

Let's be friends:

Likes
There are no likes...yet! 👀
Be the first to like this post!
It looks like you're not logged in.
Sign in to see who liked this post!