I'm using MongoDb 2.6.1 following the material from https://university.mongodb.com/ (great material by the way) but I am not being able to add to my path the mongo commands.
I've followed this guide http://docs.mongodb.org/manual/tutorial/install-mongodb-on-os-x/ and I modified my .bashrc like this
export PATH=/Users/jonathancaballero/bin/mongodb/mongodb_2.6.1/bin:$PATH
And there is indeed where the binaries are (checked using the finder directly)
So my question is why I am not able to use mongod from any location in my terminal?
Run the Mongo daemon, in one terminal window run ~/mongodb/bin/mongod . This will start the Mongo server. Run the Mongo shell, with the Mongo daemon running in one terminal, type ~/mongodb/bin/mongo in another terminal window. This will run the Mongo shell which is an application to access data in MongoDB.
Please put the PATH
export into .bash_profile
:
export PATH=/path/to/your/mongo/bin:$PATH
Edit: The reason to put it into .bash_profile
is that this file will usually get executed when bash is started as a login shell while .bashrc
usually is exectuted for interactive non-login-shells. What usually happens is that .bashrc
gets sourced in .bash_profile
. This does not seem to be the case here. On MacOS X when you start a Terminal, .bashrc
does not get executed. God knows why, as the shell opened should be an interactive non-login shell and therefor should execute .bashrc
.
Another, albeit more "intrusive" solution would be to add the following to .bash_profile
.
if [ -f ~/.bashrc ]; then
source ~/.bashrc
fi
For those who are interested in the details: take a look into the according sections of bash's manpage
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With