Mongodb Download Mac Os X

Easy spets to nstall MongoDB on Mac OS X ( I have used MAC OS – Mavericks)

Mac OS X How to automatically run elasticsearch on Startup for Mac OS X. If you are like me you want most of the things to be automate like my previous post showing you how to run MongoDB on StartUp for Mac OS X, and this post. There are many MongoDB GUI available for Mac Operating System, the most used GUI I think are MongoDB Compass. Use this tutorial to manually install MongoDB 5.0 Community Edition on macOS using a downloaded.tgz tarball. MongoDB Version¶. This tutorial installs MongoDB 5.0. Community Edition. To install a different version of MongoDB Community, use the version drop-down menu in the upper-left corner of this page to select the documentation for that version. Using MongoDB on Mac OS X with Homebrew.

Step 1: Download MongoDB:

Download MongoDB for MAC OS from official MongoDB site:

Step 2: Install MongoDB:

Step 3: Create MongoDB Data Directory:

By default, MongoDB write/store data into the /data/db folder, you need to create this folder manually and assign proper permission as given below:

Step 4: Set you PATH on Bash Profile for MongoDB:

Create a ~/.bash_profile file if not exists else update, and assign /usr/local/mongodb/bin to $PATH environment variable, so that you can access MongoDB on commands easily.

Step 5: Setting for auto start MongoDB:

To auto start yor installed mongoDB, create a launchd job on your Mac OS.

And add the following content to “/Library/LaunchDaemons/mongodb.plist”

Mongodb on mac

Save the file and load the above job:

Now restart your MAC OS.

Step 6: Start MongoDB:

If you already have added the above steps then MongoDB will start by the time your MAC OS started.

Download free mac os x

Otherwise you have to start MongoDB by using the below command:

Now ready to use MongoDB,

Introduction

MongoDB and macOS make a complementary duo. MongoDB is the perfect storage database for JSON documents. It offers scalability as well as flexibility for indexing and querying. Combine it with the power of macOS and you’ll unleash zooming productivity that will spoil you. Install MongoDB server macOS and there’s nothing stopping your search capabilities.

Setting up MongoDB on your macOS isn’t difficult if you have a streamlined way of getting it done. Two common ways to accomplish this are by using a Tarball archive from the MongoDB website or from the terminal with the Homebrew installer package. The latter is the simplest. If you go that route, be sure to install the brew package manager first. Let’s try both methods. This step-by-step tutorial explains how to install and setup a MondoDB on macOS.

Open a terminal instance

  • The macOS Dock might have the Terminal application anchored. If not, the “Applications” folder is where you want to open a terminal instance. Use the finder to do this.

  • Look for the “Utilities” folder, then open it and you’ll see the terminal application there.

The macOS finder shows an alphabetical listing of apps from left to right. Inside the Utilities folder is the Terminal.app.

  • Another way to install Homebrew is to run a Ruby script. If you haven’t installed Homebrew yet, use this code. The Git respository is where the Ruby script will run from to install the application.
/usr/bin/ruby -e'$(curl --insecure -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install)'

Homebrew is downloaded and installed from a macOS terminal window .

Use Homebrew to Install MongoDB

Now, you’re ready to install MongoDB. It’s best practice to update the brew packages first. You want the latest version because you want to take advantage of the latest technology.

  • To install brew, just “tap” the repository, that is to gain access to the repository after the brew update is completed.
brew tap mongodb/brew
  • The fast way to complete the tapped repository is to use the install command. It’s also important to replace your MongoDB with the latest version.
brew install mongodb-community@X.x
# or: brew install mongodb-community@4.0

Use a terminal window to run MongoDB

  • In a terminal window, start the MongoDB and run it as a service.

Also in the terminal window, use nano or another command line editor to edit the configuration file found at /usr/local/etc/mongod.conf:

Mongodb Download Mac Os X El Capitan

sudonano/usr/local/etc/mongod.conf

Great! You’ve got the MongoDB Homebrew server running!

How to Stop the terminal service, MongoDB

  • Press CTRL+C to stop the MongoDB community service and close the terminal window.
Mongodb Download Mac Os X

Stopping the MongoDB service in a macOS terminal.

Use a TAR archive to Install MongoDB

  • We covered how to install MongoDB using Homebrew and that is the simplest way to do it. Now, we’ll show you how to install the MongoDB on macOS using a TAR archive. That’s right from the source.

  • First, download the most the latest stable release of the MongoDB for macOS. It’s the “macOS 64-bit x 64” option under “OS” on MongoDB’s Download Center.

Here, the current release version of MongoDB and the macOS 64-bit x64 options are selected on the MongoDB Download Center’s website.

  • Open a macOS terminal window and switch to (cd ~/Downloads) Downloads directory.

  • Use the command for tgz archives. The tar xzf extracts the Tarball file. Make sure you have security privileges to make the changes using sudo commands.

  • A simple script installs MongoDB version 4.0.9 for macOS.

  • Verify that you have MongoDB database files. At a terminal prompt, type /data/db. It’s not there if you get the No such file or directory response. If this happens, use the command mkdir to make a new directory. Add the -p option. For the path you indicate, create the directory and associated sub-directories with the sudo command.
sudomkdir-p/data/db
  • Find out the username of the directory. The whoami is the command to use.

  • The directory will need to have the necessary permissions and full ownership given to the user. Give them.

# get the user name:
whoami
# give ownership to the user:
sudochown{SOME_USER}/data/db
# give permissions:
sudochmod-R775/data/

Configure the MONGO_PATH in the .bash_profile shell script

Where Can I Download Mac Os X

  • Find the hidden directory file .bash_profile in the (cd ~) home directory. Use ls -A to find the hidden file.

  • If the .bash_profile script isn’t there, create it with touch command:

  • If you find the .bash_profile, edit it with a text editor. Use nano if you like or use another text editor if you prefer:
sudonano .bash_profile
  • Make sure to paste this code at the end of the script:

Mongodb Install On Mac

exportMONGO_PATH=/usr/local/mongodb
exportPATH=$PATH:$MONGO_PATH/bin
  • The MongoDB working path is now set. Press CTRL+O to save the changes to the bash_profile shell file, and then press CTRL+X to exit out of nano.

  • Make sure to restart the terminal or use the source ~/.bash_profile command to reload the shell file’s settings and paths.

  • Once the tarball archive is extracted make sure to move its contents to the $PATH directory exported in the shell profile:

sudomv mongodb-osx-x86_64–4.x.x /usr/local/mongodb

Mongodb Mac Os

A screenshot of the .bash_profile shell script being edited with the nano text editor:

Start the MongoDB service on macOS

  • In the terminal window, start the service by typing mongod.

  • When you want to stop the MongoDB server, it’s the same as Homebrew. Press CTRL+C.

Conclusion

This tutorial explained how to install MongoDB server macOS. As you have learned, it’s easy to do. There are two common ways to install MongoDB: from the terminal using Homebrew or by way of the MongoDB website where you’ll use a Tarball archive. Together, macOS and MongoDB’s storage capabilities, indexing prowess, and analyzing ingenuity is all you need to propel your productivity day in and day out.