Install MongoDB without homebrew on Mac OS

Step-by-step tutorial: How to install MongoDB without homebrew

cd Downloads/ 
tar xzf mongodb-macos-x86.64-x.x.x.tgz

Move the extracted folder to /usr/local/mongodb by using the command

sudo mv mongodb-macos-x86.64-x.x.x /usr/local/mongodb
  • MongoDB stores the data in the folder/data/db
    We will create it manually by the command
sudo mkdir -p /data/db
  • Change the permission of /data/db folder
    -> to check your username, use command whoami
sudo chown yourUsername /data/db
  • Add all the path of MongoDB to the bash profile,
    -> go to the home directory by cd command and verify it by pwd
    -> list all hidden files by ls -al you will find .bash_profile , if not, create it with command touch .bash_profile
    -> Open .bash_profile with command open .bash_profile
    -> Add below code to the end of your .bash_proflie
....
export MONGO_PATH=/usr/local/mongodb 
export PATH=$PATH:$MONGO_PATH/bin

-> Save and quit
->Hit the command source .bash_profile to reload it.

  • MongoDB is installed in your system.
  • Check if it has been installed successfully or not:
    -> Open two terminals and
    -> In one of the terminal execute the command mongod  to start mongo demon
    -> In another type mongo and press enter to interact with MongoDB.

You have successfully installed MongoDB without homebrew.
Congratulations..!!