Install Mongodb On Mac Catalina

MongoDB expects the Data/data/db folders to be in a location which Mac OS Catalina does not allow. As a consequence the folders must be placed elsewhere, on one of the disk volumes. But modifying the MongoDB settings to find the new data folders is not working properly. There are many supposed solutions for this in various places on the web but none of them have solved my issues. Installing MongoDB on Mac Catalina using Homebrew This entry was posted in MongoDB and tagged Security troubleshooting on January 10, 2020 by Dan Wahlin I recently bought a new iMac and moved all of my files over using Time Machine.

MongoDB Homebrew Tap, Installing MongoDB on Mac (Catalina and non-Catalina) 14th Feb 2020. But this small setup will allow for ease of installation of many packages that are not packaged in a point and click package, in this case we will install MongoDB. 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.

14th Feb 2020

I had to reconfigure my Macbook after sending it for repairs. During the reconfiguration period, I noticed the instructions I linked to in “Setting up a local MongoDB connection” were outdated.

Here’s an updated version on how to install MongoDB on a Mac.

There are a few steps:

Install Mongodb On Mac Catalina

First, you install Homebrew. If you’re curious about what Homebrew is, read this article.

Second, find the MongoDB tap.

Third, install MongoDB.

MongoDB is now installed on your computer.

Preparations (Before MacOS Catalina)

Before you can use MongoDB, you need to create a /data/db folder on your computer to use MongoDB. You can create this folder with the following command:

You also need to give permissions to use it:

Now you can follow the rest of the article to set up your MongoDB connection.

Preparations (MacOS Catalina onwards)

Apple created a new Volume in Catalina for security purposes. If you’re on Catalina, you need to create the /data/db folder in System/Volumes/Data.

Use this command:

Then, use this command to give permissions:

Using MongoDB

In the past, I can run the mongod command to start MongoDB. This no longer works out for the box from MongoDB v4.2.3 onwards.

The best way to start MongoDB now is via brew services.

Starting MongoDB

Use this command:

MongoDB will start as a background service. Here’s what you’ll see:

You can use start instead of run. start will start MongoDB automatically when you login into your Macbook. I prefer run since I don’t want MongoDB to be running all the time.

Checking if MongoDB is running

Use this command:

Homebrew will list all running services. If MongoDB is running, mongodb-community will have a status set to started.

The Mongo Shell

If MongoDB is running, you should be able to access the Mongo shell with the mongo command.

Stopping MongoDB

Use this command:

Homebrew will stop MongoDB and let you know.

Aliases to make these easier

It’s a chore typing brew services run mongodb-community every time I want to start MongoDB.

I created some aliases to make things easier for me. Here are my aliases:

What’s next?

If you haven’t already, you should learn how to set up a local MongoDB connection.

If you enjoyed this article, please tell a friend about it! Share it on Twitter. If you spot a typo, I’d appreciate if you can correct it on GitHub. Thank you!

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.

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

Mac
Terminal

1.9 Useful commands:

Install Mongodb On Mac Catalina Os

  • 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

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.