How to install MongoDB on macOS

Date:

Share:


Jack Wallen walks you through the simple steps of getting the NoSQL database, MongoDB, installed on macOS.

Image: Sundry Photography/Adobe Stock

For those who have tried, installing MongoDB on the latest Ubuntu release version 22.04 is nothing short of a headache. The reason for this problem is that Ubuntu no longer supports libssl1.1, which is still a requirement for MongoDB. I have tried to get this powerful, NoSQL database installed and running on Jammy Jellyfish but have had zero luck. I can get it to install, but it always fails upon start.

I’ve also found installing MongoDB on AlmaLinux to be problematic. To that end, I’ve turned to another operating system for my MongoDB needs: macOS. With macOS, getting MongoDB up and running is fairly straightforward, so long as you know your way around Homebrew.

Let me show you how.

SEE: Hiring Kit: Database engineer (TechRepublic Premium)

What you’ll need

The only thing you’ll need to make this work is a macOS device. I’ll be demonstrating on a MacBook Pro. Let’s get busy.

How to install Homebrew

The first thing you’ll need to do is install Homebrew, which is a command-line package manager for macOS and a must-have for power users. To install Homebrew, log in to your macOS device, and open the terminal application from the Launchpad. With the terminal open, issue the following command:

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

That installation will take some time to successfully complete.

How to install MongoDB

With Homebrew installed, we can now install MongoDB. We’re going to install the latest version of the database server (v6). Before we run the install command, we must first tap MongoDB with Homebrew, using the command:

brew tap mongodb/brew

When this completes, we can then install MongoDB using the command:

brew install mongodb-community@6.0

Again, this command will take some time to complete. Once it does, MongoDB is installed and ready to be started.

How to start MongoDB

To start and enable the MongoDB server, issue the command:

brew services start mongodb/brew/mongodb-community

To ensure the service is running, issue the command:

brew services list

You should see that the service has successfully started (Figure A).

Figure A

mongodb command-line interface
Figure A: MongoDB is up and running like a champ.

How to connect to the MongoDB shell

To access the MongoDB shell, issue the command:

mongosh

Congratulations, you now have MongoDB 6.0 Community Edition running on macOS. You can now start building your databases for whatever project you have in mind.

Subscribe to TechRepublic’s How To Make Tech Work on YouTube for all the latest tech advice for business pros from Jack Wallen.



Source link

━ more like this

Samsung QN90D 98-inch review: solid and classy, but worth the price tag? | Tech Reader

Samsung QN90D 98-inch QLED TV “The QN90D series is excellent, but the 98-inch model fell apart for us.” Pros Excellent color accuracy Deep blacks, impressive contrast Solid on-board...

Space station crew had an amazing stroke of luck during Starship launch | Tech Reader

NASA astronaut and current space station inhabitant Don Pettit seems to have the luck of the stars. During SpaceX’s sixth test flight of...

3 great dramas on Amazon Prime Video you need to watch in November 2024 | Tech Reader

Never let it be said that Amazon Prime Video isn’t stacked with great dramas. Amazon wasn’t content to only have the great MGM...

Get ready for AI-dubbed YouTube videos | Tech Reader

YouTube has reportedly started rolling out a new AI-empowered translation feature for its content creators, one that will automatically redub a video’s contents...

ChatGPT’s latest model may be a regression in performance | Tech Reader

According to a new report from Artificial Analysis, OpenAI’s flagship large language model for ChatGPT, GPT-4o, has significantly regressed in recent weeks, putting...
spot_img