Using mongodump: "mongodump: command not found"
brew tap mongodb/brew; brew install mongodb-community
will also install mongodump
.
If you don't have the brew
command, you really should consider install Homebrew
As of MongoDB 4.4 (released July 30, 2020), you may need to install mongodump
separately because the MongoDB Database Tools (which comprises mongodump
, mongorestore
, and more) has become its own project.
I found this out because I upgraded to MongoDB 4.4 today and mongodump
stopped working.
$ mongodump
zsh: command not found: mongodump
I'm on macOS and installed MongoDB via Homebrew. To get mongodump
and friends back, I installed the MongoDB Database Tools via Homebrew:
brew tap mongodb/brew
brew install mongodb-database-tools
If you're on a different OS, this should help:
MongoDB Database Tools Installation
If you just extracted the .tgz file, the mongodump command is not available in your PATH. Go to your /bin/ subdirectory inside the directory where you have extracted mongodb.tgz, the mongodump binary should be there. Now you can execute:
./mongodump --host localhost:3002
It's much better though to install MongoDB with a package manager. Read this page: http://docs.mongodb.org/manual/tutorial/install-mongodb-on-os-x/ and use, for example, Homebrew to install MongoDB and have all the necessary binaries in PATH.