Using mongodump: "mongodump: command not found" - macos

I'm trying to get a dump of my local database and it seems I should be using:
mongodump --host localhost:3002
However, the terminal then tells me:
-bash: mongodump: command not found
Am I missing something? Or going about this the wrong way? I'm using it on Mac from the terminal.
I installed mongo (I think) using the following commands:
curl http://downloads.mongodb.org/osx/mongodb-osx-x86_64-2.4.5.tgz > mongodb.tgz
tar -zxvf mongodb.tgz

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

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

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.

brew tap mongodb/brew
brew install mongodb-database-tools

For using mongodump, mongo-tools library has to be installed from os package manager.

It's probably just not in your path, it should be in the same directory as your "mongod", and you can then run it with:
/path/to/bin/mongodump --host localhost:3002

It's in the official MongoDB docs now. For example, to install the 3.2 version:
brew tap mongodb/brew
brew install mongodb-community#3.2
Then follow the steps to update your PATH environment variable.

You have to install mongo-tools to have mongodump.
sudo apt-get install mongo-tools

For Windows Users
You can download the MongoDB Database Tools from here
And you can read the installation guide here

Related

Where is mongoimport installed on Mac OS X

I'm trying to setup a cronjob for a regularly scheduled import of json data into a mongo database. To conduct the import, I have the following command in the Python script that the cronjob runs:
os.system("mongoimport --jsonArray --db %s --collection %s --file .../data.txt" %(db_name,collection_name))
However, the log file of the cronjob keeps displaying the following error:
sh: mongoimport: command not found
I think I need to call mongoimport with the full file path in the code, but I'm not sure where mongodb/mongod/mongoimport is installed on my system. whereis mongoimport, whereis mongodb, whereis mongod all return nothing.
I installed mongodb with Homebrew. Packages installed with Homebrew are located in /Library/Caches/Homebrew. However, in my system that folder only has a mongodb-2.6.4_1 tar file. Do I have to unpack this tar file to access mongoimport?
Thanks for your help.
As of June 2020,
I installed mongodb latest version using brew as per the documentation , and I faced the same issue command not found: mongoimport .
I had to to install mongodb-database-tools
brew install mongodb/brew/mongodb-database-tools
Then I could use mongoimport
Just adding this solution, incase it helps someone
Got the same issue, but I installed mongodb via Mac Port. Unfortunately, from version 3 of mongodb, these mongodb tools are maintained as a separate project, so I updated Mac port to latest version then installed mongo tools separately.
sudo port install mongo-tools
Hope this helps someone that installing mongodb by mac port.
If you installed MongoDB correctly you need to create a ~/.bash_profile and assign /usr/local/mongodb/bin to the $PATH environment variable
After that you should be able to access the mongoimport command
If you used brew for installation, mongod is in /usr/local/bin/ directory. Other utilities (mongoimport, mongoexport etc.) are in the same path. All you need to do is open another terminal.
Visit https://www.mongodb.com/download-center/community and you can download a tarball for MacOS, which contains all the tools including mongoimport.
Untar, add to you PATH and voilà!
Try using ./mongoimport or sudo ./mongoimport
After following all of these examples, I was able to use it that way from bash.

How to install mcrypt extension on mac os x yosemite (10.10)

I've updated my Mac OS X to Yosemite, but doing that I over write all my dev environment. So now, to run Laravel 4 on my local apache I need to install the Mcrypt extension, but everything that i've tried i fail. Even the steps that have worked on OS X Mavericks (10.9)
Anybody has the same issue?
Thanks in advance.
Cheers
I just installed it right now on my Mavericks installation using homebrew and it worked surprisingly well. Can't say whether or not it will work so well on Yosemite but worth a shot..
Homebrew
brew install autoconf
brew install mcrypt
Macports
Check PHP version
php -v
Update Macports
sudo port -v selfupdate
Download & install the appropriate version..
sudo port install php55-mcrypt
now dummy proof it..
Find where Macports put the file mcrypt.so and copy it to all instances of /php/extensions/no-debug-... folder. If you have that directory structure in multiple places, copy it to all of them. So every php/extensions/no-debug.. folder on your computer has a copy of mcrypt.so
sudo cp /opt/local/lib/php/extensions/no-debug-non-zts-20090626/mcrypt.so /usr/lib/php/extensions/no-debug-non-zts-20090626/
Determine where your php.ini file is and make sure it's the one your actually using because you may have this file in more than 1 place. Do this to all php.ini files you find..
Within that file find and uncomment the following line. If it's commented out, uncomment it. If it's not in the file at all, add it. In my default php.ini file I found this on line 536:
extension=mcrypt.so
Compile
Download mcrypt
curl -O http://downloads.sourceforge.net/project/mcrypt/Libmcrypt/2.5.8/libmcrypt-2.5.8.tar.gz
Uncompress it
tar -zxvf libmcrypt-2.5.8.tar.gz
Configure, build, and install
./configure && make && sudo make install
Download Autoconf
curl -O http://ftp.gnu.org/gnu/autoconf/autoconf-latest.tar.gz
Uncompress it
tar xvfz autoconf-latest.tar.gz
Configure, build, and install
./configure && make && sudo make install
Apache
Regardless which method you used to install it. You should always restart Apache when your done.
Restart Apache
sudo apachectl restart
I just did these and it installed. MAMP etc. is not installed.
brew tap josegonzalez/homebrew-php
brew install php55-mcrypt
And weirdly, I had to reinstall to make it install properly.
brew reinstall php55-mcrypt
However, this also re-installed PHP5.5 from source, but no matter, all is working fine on my end.
I had the same problem. But, I'm using MAMP for my local development. So, I just needed to symlink the php file over to MAMP's version and all is working.
If using homebrew, try reinstalling or relinking your php install.
I'm sure I can help you get back up and working, so just let me know if that doesn't help.
First Install libtool from homebrew, which is a dependency in 10.10 Yosemite
brew reinstall libtool --universal && brew unlink libtool && brew link libtool
Then CD to your php directory
cd /usr/local/php5
And into your php.d directory
cd php.d
Then finally do a quick ls to see which extensions you are using:
ls -l
If you see duplicate entries containing "mcrypt" you will need to open one of them up, and comment out the line:
extension=mcrypt.so
to
;;extension=mcrypt.so
But only in one of them. For me it was mcrypt.ini. So..
sudo nano mcrypt.ini
added the line and done!

MongoDB installed via Homebrew not working

I installed MongoDB via Homebrew (following http://docs.mongodb.org/manual/tutorial/install-mongodb-on-os-x/) but it's not working.
Typing mongod at shell prompt gives me:
-bash: mongod: command not found
Not sure if I need to add something for Homebrew to my PATH env var?
I can see Mongo is installed under /usr/local/Cellar/mongodb – but am assuming I don't need to add everything I install via homebrew to the path? Also, assuming I can run mongod from any directory or am I actually meant to be in install directory?
When I run brew doctor I get:
Warning: You have unlinked kegs in your Cellar
Followed by a list of 3 items which includes MongoDB – but I'm not sure how I'm meant to link them?
Works perfectly
brew update
brew tap mongodb/brew
brew install mongodb-community#4.2
For latest version, check https://docs.mongodb.com/manual/release-notes/
You're getting this error because your 'brew' install failed to create the correct symlinks in /usr/local/bin. As a result, the shell can't find the mongo executables in your $PATH. You can fix this using the following steps:
Check the permissions on /usr/local/bin and make sure that you own that directory and have write permissions on it
$ ls -ld /usr/local/bin
Once you've fixed that, run 'brew link' to fix the symlinks
$ brew link mongodb
If you are on mongodb-community#4.0. You can try to reinstall with brew reinstall mongodb-community#4.0.
Then I get the following hint:
==> Caveats
mongodb-community#4.0 is keg-only, which means it was not symlinked into /usr/local,
because this is an alternate version of another formula.
If you need to have mongodb-community#4.0 first in your PATH run:
echo 'export PATH="/usr/local/opt/mongodb-community#4.0/bin:$PATH"' >> ~/.bash_profile
So you can just copy the echo command and restart your shell!
Copied from a different channel running these commands in the terminal updated the installation/configuration issues as described in OP
brew tap mongodb/brew
brew install mongodb-community
brew services start mongodb-community
I faced the same problem and this solution seemed to work for me. I had previously uninstalled mongodb and reinstalled it through homebrew which gave me a bunch of problems. This solution seemed to work just fine.
brew uninstall --force mongodb
brew cleanup -s mongodb
brew cleanup --prune-prefix
brew install mongodb
It works from the directory since the sh searches the ENV path and then the cwd for a program named mongod. I have been looking around a little and it seems that the default install of MongoDB (I am not a Mac user) does not install a rc or init script for which sh to understand it's running behaviour as stated here:
http://docs.mongodb.org/manual/tutorial/install-mongodb-on-os-x/#using-mongodb-from-homebrew-and-macports
The packages installed with Homebrew and MacPorts contain no control
scripts or interaction with the system’s process manager.
If you have configured Homebrew and MacPorts correctly, including
setting your PATH, the MongoDB applications and utilities will be
accessible from the system shell. Start the mongod process in a
terminal (for testing or development) or using a process management
tool.
So you must actually define (as you said) MongoDBs path, here is an example: https://snipt.net/sido/installing-mongodb-on-os-x/
Edit: the example is not mine. I just stole it from it's user: https://snipt.net/sido/

unable to install elasticsearch plugin

I've downloaded elastic search plugin from
https://github.com/downloads/spinscale/elasticsearch-suggest-plugin/elasticsearch-suggest-0.0.3-0.18.6.zip
I've unzipped the folder and I know i'm supposed to put the 3 jar files in the lib/ directory (of play itself or of the application I'm creating or that of elasticsearch). but which lib/ directory shall i put it in? also, what shall i do next. i tried to understand the documentation on the website but i didn't.
I'll really appreciate any help as I've been trying for 2 days to install this plugin. I'm using play 1.2.4
Using current homebrew installation (March 2016 -- 2.2.0_1 version) resulted in the plugin executable not being linked, therefore i had to do:
$ ~HOMEBREW_ROOT/Cellar/elasticsearch/2.2.0_1/libexec/bin/plugin install mobz/elasticsearch-head
MAC OS - with brew elasticsearch base install
Install the elasticsearch package with brew :
brew install elasticsearch
Install the elasticsearch_head plugin to get a simple browser :
cd /usr/local/Cellar/elasticsearch/1.4.0/
sudo bin/plugin -install mobz/elasticsearch-head
open "http://127.0.0.1:9200/_plugin/head/"
Grab the plugin script path by using this command on Mac OS
brew info elasticsearch
Then, use the plugin script path to install:
/usr/local/Cellar/elasticsearch/2.3.3/libexec/bin/plugin install some/es-plugin
Download elastic search deb file from this link elastic search
and once installed then check elastic search status like sudo service elasticsearch status
To view elastic search index in GUI, run this command from your /usr/share directory
sudo elasticsearch/bin/plugin -install mobz/elasticsearch-head
open "http://localhost:9200/_plugin/head/"
Try the builtin bin/plugin utility:
% bin/plugin -url https://github.com/downloads/spinscale/elasticsearch-suggest-plugin/elasticsearch-suggest-0.0.3-0.18.6.zip -install elasticsearch-suggest
-> Installing elasticsearch-suggest...
Trying https://github.com/downloads/spinscale/elasticsearch-suggest-plugin/elasticsearch-suggest-0.0.3-0.18.6.zip...
Downloading ..............................................................................DONE
Installed elasticsearch-suggest
% find plugins/elasticsearch-suggest
plugins/elasticsearch-suggest
plugins/elasticsearch-suggest/elasticsearch-suggest-0.0.3.jar
plugins/elasticsearch-suggest/lucene-misc-3.5.0.jar
plugins/elasticsearch-suggest/lucene-spellchecker-3.5.0.jar
%
In one line:
sudo /usr/share/elasticsearch/bin/plugin -install mobz/elasticsearch-head
For ElasticSearch 7.10 in Ubuntu:
cd /usr/share/elasticsearch
sudo bin/elasticsearch-plugin install analysis-phonetic

Installing meld on OS X

After I got MacPorts installed and did a 'sudo port -v selfupdate', I try to install meld.
The installation just starts to Fetching all kinds of stuff
gnome-comoon
perl5.8
perl5
pkgconfig
.....
this goes on and on.
Is that normal?
You may want to install it via HomeBrew (already mentioned before):
brew install homebrew/gui/meld
Though you may face stability issues (as I did). So I'd rather recommend to use "Meld for OSX":
Go to https://yousseb.github.io/meld/
Download DMG file you prefer (e.g. "Download latest DMG" https://github.com/yousseb/meld/releases/download/osx-6/meldmerge.dmg)
Install it to your Applications folder
We are basically done, but it is not accessible via command line.
Solution:
Write a small wrapper to run from Terminal:
echo -e '#!/bin/sh
params="$#"
open -W -a Meld --args $params' | sudo tee /usr/local/bin/meld
sudo chmod +x /usr/local/bin/meld
Try (you must use absolute paths though):
meld /home/a.txt /home/b.txt
Or just run Meld from menu.
meld is now available in homebrew. The formula can be found here.
See this answer by cmedeiros on SuperUser for more information on installing and getting it to work. This is much easier than using MacPorts.
Current command with updated formula to install meld with homebrew is:
brew install caskroom/cask/meld
Yes, it is normal to pull in dependencies but it shouldn't take too long. For comparison, installing Meld with Homebrew took about 15 minutes for me.
For reference, my installation of Meld on OS X Mavericks:
Install Xcode from the app store
Install XQuartz from package (Meld will complain if you don't have it)
command line: 'brew install meld'
If you are prompted to install the Xcode command line tools at some point, do so.
Hope this helps.
Unfortunately, the is very normal with MacPorts, and is the reason that people many have switched to homebrew http://github.com/mxcl/homebrew
However, I found this post because homebrew doesn't include Meld. Sigh.
Consider downloading macOS meld version dmg https://github.com/yousseb/meld/releases/
Brew now works brew install --cask meld.
See https://formulae.brew.sh/cask/meld#default
UPDATE Jul-23-2020
Just do :
brew install homebrew/gui/meld
using the updated brew link: brew install caskroom/cask/meld
even after this its not working when I install backup and restore tool by google. I guess its messing up with the python version.

Resources