Can't Use Mongo Command, Shows Command Not Found On Mac


Answer :

You need to add the path to "mongo" to your terminal shell.

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

Did you do the last step with paths.d? If so, try restarting your terminals.

Do you have a good reason for using 1.8.5? The current stable is 2.0.4, and it has many useful upgrades from 1.8.x


You'll have to add the location of the Mongo binary to PATH.

Follow the steps below in order to make the PATH variable permanent:

  1. Open Terminal and navigate to your user directory.
  2. Run touch ~/.bash_profile and then open ~/.bash_profile.
  3. In TextEdit, add export PATH="<mongo-directory>/bin:$PATH" (Keep the quote marks - related to white spaces).
  4. Save the .bash_profile file and Quit (Command + Q) Text Edit.
  5. Run source ~/.bash_profile.
  6. Run echo $PATH and check if the you see that the Mongo binary was added.

(*) Notice that the PATH variable is now available only for the current terminal and not to processes that were already started in the session.
In order to make it available outside the current terminal - you'll have to logout and login.


1.Go to your [mongodb installation dir]:

cd <mongodb installation dir> 

2.Type ./bin/mongo to start mongo:

./bin/mongo 

Read More

Note :

If above command gives error

Failed global initialization: BadValue Invalid or no user locale set. Please ensure LANG and/or LC_ environment variables are set correctly.*

Run bellow command: Read More

export LC_ALL=C 

How can find installation directory

find / -name "mongodb"  

You can also set path

export PATH=$PATH:<mongodb installation dir>/bin 

Comments

Popular posts from this blog

Are Regular VACUUM ANALYZE Still Recommended Under 9.1?

Can Feynman Diagrams Be Used To Represent Any Perturbation Theory?