I will be following the official documentation here but they take some things for granted, many users could get frustrated and confused that's why I created this gist.
I have downloaded the mongo files in my root user directory for example: /Users/israel/mongodb therefore if you want to do the same first enter cd in your terminal.
then enter pwd command in your terminal and you should be able to se something similar to /Users/<yourmacuser>
If the previous is correct you may want to proceed and open the terminal then download the tar:
curl -O https://fastdl.mongodb.org/osx/mongodb-osx-x86_64-3.0.5.tgzExtract the tar
tar -zxvf mongodb-osx-x86_64-3.0.5.tgzThen:
mkdir -p mongodb
cp -R -n mongodb-osx-x86_64-3.0.5/ mongodbIn Mac OS you have to create the file .bash_profile here is where we are going to point the binaries so you can access the mongod command everywhere.
nano .bash_profileAdd the following line to the file:
export PATH="/Users/<yourmacusername>/mongodb/bin:$PATH"Save the file. Mongo should be accesible now
I created the data folder in my home folder /Users/israel/mongodata
cd
mkdir -p mongodataThen I just execute the following command to register the path in mongodb
mongod --dbpath /Users/<your mac username folder>/mongodata:)
Hi,
Thanks for the detailed tutorial!
When I run this "mongod --dbpath /Users//mongodata" I get "mongod: command not found".
Do you know what could be happening?
Thanks!