Install MongoDB without homebrew on Mac OS π¨π»βπ»
well as a Mac user, I personally prefer homebrew to install a new package in my MacBook. but sometimes due to upgrade in os or due to some technical issue or maybe some other shit..!! the brew is unable to install the desired package.
and you donβt have time to debug the issue because time is money π
donβt worry.. I will tell you how to install MongoDB step by step without homebrew
first download MongoDB from its official website https://www.mongodb.com/download-center/community hit server tab, by default it will land you on cloud tab
after that go to your download folder through terminal screenshot and command both given below
cd Downloads/
you will see the downloaded tar file of MongoDB. use the below command π to extract tar file to the corresponding folder
tar xzf mongodb-osx-ssl-x86_64-4.0.5.tgz
now move the extracted folder to /usr/local/mongodb
by using the command
sudo mv mongodb-osx-x86_64-4.0.5 /usr/local/mongodb
by default MongoDB stores the data in the folder/data/db
, which is not present by default, so we have to create it manually by the command
sudo mkdir -p /data/db
after that, we need to manually change the permission of /data/db
folder by command but first check your username, you can find it by command whoami
and use it in the below command as I do
sudo chown saurabh /data/db
now we have to add all the path of MongoDB to the bash profile, for that first go to the home directory by cd
command and verify it by pwd
like below
now list all hidden files by ls -al
you will find .bash_profile
over there, if not, create it with command touch .bash_profile
open .bash_profile
with command open .bash_profile
you will see it will open in textEdit and it will be something like that based on your current system configuration π
now copy the below code π to the end of your .bash_proflie
export MONGO_PATH=/usr/local/mongodb export PATH=$PATH:$MONGO_PATH/bin
and save it by pressing βcommand + sβ. your .bash_profile
will now look something like below
after saving close the .bash_profile
and hit the command source .bash_profile
to reload it and that's itβ¦!!! π
you have done all the steps required to install MongoDB in your system.
now itβs time to check if it has been installed successfully or not. for that open two terminals like below π and in one of the terminal first type the command mongod
and execute it to start mongo demon and in another type mongo
and press enter to interact with MongoDB.
Congratulations..!! π π π you have successfully installed MongoDB without homebrew. Go get yourself a beer for all the hard work you have done. cheers..!! πΊ
P.S. If you like this article and want more like these, please press clap as much as you like
About the Author
feel free to follow me on GitHub π https://github.com/SK-CSE
or connect with me on LinkedIn π https://www.linkedin.com/in/saurabh-kumar-7748015a/
for more post like this follow us π https://medium.com/khojchakra