Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Mongod: Command Not Found (OS X)

Tags:

I am trying to test MongoDB and I have it all downloaded and moved into the root folder. I can navigate to the folder that holds the mongod, but when I try to run it by typing "mongod" into my terminal, I get a message that says:

"mongod: command not found"

like image 644
MissElizabeth Avatar asked Apr 04 '14 12:04

MissElizabeth


People also ask

What is mongod command?

mongod is a background process used by MongoDB. The main purpose of mongod is to manage all the MongoDB server tasks. For instance, accepting requests, responding to client, and memory management. mongo is a command line shell that can interact with the client (for example, system administrators and developers).

How do I know if MongoDB is installed on my Mac?

“how to check if mongodb is installed” Code Answer'sOpen the command prompt and type "cd c:\program files\mongodb\server\your version\bin". After you enter the bin folder type "mongo start". If you get either a successful connection or failed one it means it's installed at least.

Why MongoDB command not found?

To correct this issue, you can delete the file sudo rm /tmp/mongodb-27017. lock and then start the mongod process once more, which will recreate the file. It says rm: /tmp/mongodb-27017.


1 Answers

Both answers above are correct. You can either specify the path in one of the following files: .profile, .bashrc, or .bash_profile

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

then call the daemon or the shell directly

mongod mongo 

Or for the commands not in the $PATH, use ./mongo or ./mongod from the directory containing these files. This solution can be verbose has you will have to eventually append the whole path when calling these commands from another directory.

/usr/local/mongodb/bin/mongod or /usr/local/mongodb/bin$ ./mongod  
like image 105
Laurent Jacquot Avatar answered Feb 05 '23 07:02

Laurent Jacquot