Install Mongodb On Mac Catalina

This article shows how to install Maven (3.6.3) on macOS Big Sur (version 11.1).

Installing MongoDB on Mac (Catalina and non-Catalina) Updated steps to install MongoDB on a Mac. I had to reconfigure my Macbook.

Topics

Related Articles

  1. 问题I have installed mongodb on my mac Catalina 10.15. I have php7.3 version installed as well. Now, I want to use the mongoClient class with PHP. I tried composer require mongodb/mongodb but it says.
  2. Setup MongoDB on macOS Catalina 10.15 and above Coding In depth in Mac O'Clock To uninstall MongoDB on Mac OS X you should run the following commands to remove mongodb from the launch/startup and to uninstall it using Homebrew: launchctl list grep mongo. Launchctl remove homebrew.mxcl.mongodb. Pkill -f mongod. Brew uninstall mongodb.

1. Homebrew install Maven on macOS

1.1 Install Homebrew, a package manager on macOS.

1.2 The command brew install maven will install the latest Maven.

Terminal

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}

Terminal

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

Terminal

1.6 Where does Homebrew put the core mvn executable file?
The mvn is at /usr/local/bin/

Terminal

1.7 brew info maven to show the detail of the Maven package.

1.8 brew list maven

Terminal

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

How To Install Mongodb On A Mac

Install mongodb on mac catalina os

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

Terminal

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.

~/.bash_profile

P.S Read this Zsh Startup Files.

2.5 Source the ~/.zshenv to reflect the changes.

2.6 Verification.

Terminal

Done.

References

mkyong

Founder of Mkyong.com, love Java and open source stuff. Follow him on Twitter. If you like my tutorials, consider make a donation to these charities.

MongoDB is a general purpose, document-based, distributed data platform built for modern application developers and for the cloud.

MongoDB is classified as a NoSQL database. It uses JSON-like documents with optional schemas.

This tutorial shows you how to install MongoDB on a Mac via Homebrew.

Installation Options

You can use MongoDB as a cloud deployment, or as an on-premise installation. In this tutorial, we install it as an on-premise installation.

When you install it on-premise, you have a choice of installing the Enterprise Server or the free Community Server. In this tutorial, we install the free Community Server.

There are a couple of ways to install MongoDB on a Mac.

  • Option 1: Install it via Homebrew (recommended).
  • Option 2: Install it manually with the installation files.

In this tutorial, we use install it using option 2 (via Homebrew).

Installing MongoDB via Homebrew is recommended, because it automatically installs all needed dependencies, provides an example mongod.conf file to get you started, and simplifies future upgrade and maintenance tasks.

Prerequisites

Because we’re installing MongoDB via Homebrew, this requires that we have Homebrew installed on our Mac.

If you’re not sure whether you have Homebrew installed, open a Terminal window and enter the following:

If you’ve got Homebrew installed, this will return a bunch of Homebrew related information. If not, you probably need to install Homebrew.

To install Homebrew, run the command listed on the Homebrew homepage.

Install mongodb on mac catalina download

Be sure to read the installation requirements first. In particular, you’ll need Xcode to be installed on your Mac before you install Homebrew.

Install MongoDB

OK, now that we’ve got Homebrew installed, we can go ahead and use it to install MongoDB.

Run the following command into a Terminal window:

That downloads the official Homebrew formulae for MongoDB and the Database Tools.

Run the following:

That simply checks that your system meets all the installation prerequisites. If it does, the brew tap (mongodb/brew) will be listed.

If it doesn’t make sure your system meets the requirements listed at the link given above.

Run the following:

That’s the part that actually installs MongoDB. In this case we’re installing version 4.4. Feel free to change that part to match the actual version that you’re installing.

You can check the MongoDB website for the latest releases. You can modify the above code to reflect the latest release.

You can also run multiple versions side by side if you like.

Run MongoDB

Now that MongoDB is installed, you will need to start it up.

When you run MongoDB, you run the mongod process. mongod is the primary daemon process for the MongoDB system.

There are a couple of ways to run MongoDB (i.e. the mongodb process):

Mac
  • Option 1: Run it as a MacOS service
  • Option 2: Run it manually as a background process

Option 1

To run it as a MacOS service, enter the following command:

Install

You can stop it like this:

Option 2

To run it as manually as a background process, enter the following command:

To stop a mongod running as a background process, connect to the mongod from the mongo shell, and issue the shutdown command.

Verify that MongoDB is Running

You can check that MongoDB is running by issuing one of the following commands, depending on whether it’s running as a MacOS service or a background process.

If you started MongoDB as a MacOS service:

You should see the service mongodb-community listed as started.

If you started MongoDB as a background process:

Install Mongodb On Mac Catalina Operating System

You should see your mongod process in the output.

Connect to MongoDB

Now that MongoDB is up and running, we can connect to it and start using it.

From a new Terminal window, enter the following:

That connects a mongo shell to the running MongoDB instance.

That should display a bunch of text, and at the end, you should see the following prompt:

This means that it’s ready to accept your commands.

Install Mongodb On Mac Catalina Island

Enter a Command

Once connected, you can enter as many commands as you need.

For starters, enter the following command to display a list of databases:

Install Mongodb On Mac Catalina Download

That should result in the following databases being displayed: