Install MongoDB On Mac M2 Without Home-brew

1

https://www.mongodb.com/docs/manual/tutorial/install-mongodb-on-os-x/

Note: 1 >> In the above image, we have to create a folder called MongoDB in our root directory example : codallt@systemss-MacBook-Air ~ % mkdir -p mongodb
codallt@systemss-MacBook-Air ~ % cp -R -n mongodb-osx-x86_64-3.0.15/ mongodb
export PATH=/Users/username/mongodb/bin
codallt@systemss-MacBook-Air ~ % sudo mkdir -p data
codallt@systemss-MacBook-Air ~ % cd data
codallt@systemss-MacBook-Air data~ % sudo mkdir -p db
codallt@systemss-MacBook-Air ~ % sudo chown -R $USER data/db
codallt@systemss-MacBook-Air ~ %./mongodb/bin/mongod --dbpath ~/data/db
codallt@systemss-MacBook-Air ~ % ps ax|grep mongod
OR
ps -ef | grep mongod | grep -v grep | wc -l | tr -d ' '
This will get you the number of MongoDB processes running, thus if it is other than 0, then you have MongoDB running on your system.
codallt@systemss-MacBook-Air ~ % sudo kill 45429

To start the Mongo client, run the below command

codallt@systemss-MacBook-Air ~ % ./mongodb/bin/

You will get below logs if your client is up and running

codallt@systemss-MacBook-Air ~ % ./mongodb/bin/
2024-01-13T13:17:48.652+0530 I CONTROL  machdep.cpu.extfeatures unavailable
MongoDB shell version: 3.0.15
connecting to: test
Welcome to the MongoDB shell.
For interactive help, type "help".
For more comprehensive documentation, see
	http://docs.mongodb.org/
Questions? Try the support group
	http://groups.google.com/group/mongodb-user
Server has startup warnings: 
2024-01-13T12:51:02.152+0530 I CONTROL  [initandlisten] 
2024-01-13T12:51:02.152+0530 I CONTROL  [initandlisten] ** WARNING: soft rlimits too low. Number of files is 256, should be at least 1000
> 

open your .bash_profile or any other file where you have other path variables and update the below paths.

export MONGO_PATH=/usr/local/mongodb
export PATH=$PATH:$MONGO_PATH/bin

Step 1 : Start the MongoDB server as follows by providing the <db path>

codallt@systemss-MacBook-Air ~ % mongod --dbpath ~/data/db

Step 2 : Now open another terminal tab and Start the mongo client as follows

codallt@systemss-MacBook-Air ~ % mongo

1 thought on “Install MongoDB On Mac M2 Without Home-brew

Leave a Reply

Your email address will not be published. Required fields are marked *