9

I recently installed macOS Catalina 10.15 Beta 1. Now, when I try to launch my MongoDB application by running:

> mongod

I get the following error:

enter image description here

I have attempted to go to Security & Privacy and hit the Open Anyway button, but I get the same error.

Any thoughts on how to launch the application from the command line?

  • 1
    Have you tried opening it with CTRL pressed and select Open? – fsb Jun 21 '19 at 21:40
  • 1
    Unable to open it with CTRL pressed because I have to open mongod server from the command line as there is no app in the applications. – zpeters Jun 24 '19 at 20:21
  • As an alternative, I would like to suggest running MongoDB (and your application maybe) from Docker Desktop. – Markus W Mahlberg Oct 10 '19 at 7:24

12 Answers 12

4

Throw away your installation (saving any database files you need / export them) and then install the version from https://brew.sh

brew install mongodb
mongod --config /usr/local/etc/mongod.conf

You should be able to get v4.0.3 running without error and then compare if your distribution is compatible or needs adjustment if you can't use the mainline version for macOS.

Installing the program from the command line bypasses the gatekeeper checks and such and might be easier while the beta is new.

  • 1
    So... that produced another problem. Apparently my homebrew was hosed too. I threw ALL of it away. I mean ALL. I burned the whole thing down, erased the HD, reloaded macOS Mojave, upgraded to Catalina [10.15b2], reloaded homebrew and mongoDB. I guess I had a good deal of detritus all over my system that was preventing the original use. Good news is that I have a clean system to work from now. :) – zpeters Jun 24 '19 at 20:25
  • Awesome! I’ve heard many brew survive the upgrade, but I’m glad a clean start worked and you didn’t have to assume it was just a mongo mess. – bmike Jun 24 '19 at 22:56
13

Move your old /data/db folder into a non root folder and do the following:

brew uninstall mongodb
brew tap mongodb/brew

brew install mongodb-community

"brew install mongodb" won't work anymore as the mongodb is removed from the homebrew-core.

check https://github.com/mongodb/homebrew-brew for more info

ref: https://stackoverflow.com/a/57881349/10818622

  • 1
    So... that produced another problem. Apparently my homebrew was hosed too. I threw ALL of it away. I mean ALL. I burned the whole thing down, erased the HD, reloaded macOS Mojave, upgraded to Catalina [10.15b2], reloaded homebrew and mongoDB. I guess I had a good deal of detritus all over my system that was preventing the original use. Good news is that I have a clean system to work from now. :) – zpeters Oct 10 '19 at 19:33
3

For me it works without brew: Go to the folder, where the mongod binary is saved. Right click on it and then say: Open with - Terminal. It will ask you, if you really want to open. Click open. After that you can open it always without any further question dialogs.

  • that worked fine for me. Unfortunately Catalina just removed my /data/db folder ... WTF. Well, had a backup and copied it to my home folder now. Works as expected! – djnose Oct 16 '19 at 8:18
  • @Lupurus Could you clarify where there binary is normally at when installing with homebrew? – kbpontius 2 days ago
  • @kbpontius: I didn’t install via homebrew, I downloaded the binaries from mongodb.com – Lupurus yesterday
2

If mongo deamon can't create a db due to invalid file permission (in Catalina you cant create db folder in root as /data/db) or you missing mongod.conf (or mongo db can't read it).

brew uninstall mongodb
brew tap mongodb/brew
brew install mongodb-community

And start mongod manualy with

mongod --dbpath=/path/to/mongo/db
2

After you have installed it on Catalina, AND tried to run mongo in the terminal, you can go to Security and Privacy and in there, at the bottom you should see an option to allow "anyway". Then you will be able to run mongo and the other executables from the terminal.

1

Very late to the party here, but I've read that Catalina does not allow anything to be written on the root directory /

https://www.reddit.com/r/mongodb/comments/d7takd/macos_x_catalina_105_beta_and_mongo_a_warning/

Furthermore, your dbpath like others have mentioned, should also be placed in non-root directories as discussed here.

https://stackoverflow.com/questions/58283257/mongodb-doesnt-work-on-latest-mac-os10-15

1

I actually found my missing Mongo database. Apple had quietly moved it to Users/Shared/Relocated Items, along with my customized Apache conf file and a few other items. So nice of them to tell people all about this. This Apple install certainly sucked.

1

From Apple: https://support.apple.com/guide/mac-help/open-a-mac-app-from-an-unidentified-developer-mh40616/mac, the salient point for services that you didn't open from the Finder being:

Note: You can also grant an exception for a blocked app by clicking the Open Anyway button in the General pane of Security & Privacy preferences. This button is available for about an hour after you try to open the app.

To open this pane on your Mac, choose Apple menu > System Preferences, click Security & Privacy, then click General.

1

this can be useful

# copy from line 3 to 12 and paste in terminal

sudo mkdir -p /Users/$USER/mongo/db; # to ask for a password at the beginning
/usr/bin/ruby -e "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install)"; # install homebrew
brew install wget; wget https://fastdl.mongodb.org/osx/mongodb-macos-x86_64-4.2.1.tgz;
tar -zxvf mongodb-macos-x86_64-4.2.1.tgz;
cd mongodb-macos-x86_64-4.2.1; 
sudo cp ./bin/* /usr/local/bin/; sudo ln -s ./bin/* /usr/local/bin/;
cd ..; rm -rf mongodb-macos-x86_64-4.2.1 mongodb-macos-x86_64-4.2.1.tgz;

mongod --dbpath=/Users/$USER/mongo/db; # start the mongo server

https://gist.github.com/sturmenta/cf19baa91b1d79d8ae2b305fb7e1f799

1

I also recently (4 days ago) updated to Catalina 10.15.2.

I also had the same error as reported by the OP.

My solution went as per the answer above

https://apple.stackexchange.com/a/377998/163049

but I had also used macports to install mongodb, and so it was installed with a view to using /data/db as the default. Hence I ran into the problem described here.

MongoDB can't find data directory after upgrading to Mac OS 10.15 (Catalina)

That is, my /data/db directory had been moved to /Users/Shared/Relocated\ Items/Security/data/db. So mongod still wouldn't start.

So I migrated my MacPorts installation to the Catalina version, by (mostly) following the instructions here:

Migrating MacPorts after a major operating system upgrade or from one computer to another

At the moment I am running

port upgrade outdated

The theory is that mongod will be reinstalled in such a way as to work properly on Catalina. That way I avoid the misery of trying to work out how to write a valid YAML file. I hate YAML.

New contributor
Magic Thighs is a new contributor to this site. Take care in asking for clarification, commenting, and answering. Check out our Code of Conduct.
1

I updated to Catalina 10.15.2 from 10.14.X and the new security failed to recognize mongo as a trusted developer. Trying to run mongod in terminal triggered a system dialog (popup) refusing to run mongod with no option to override it.

System Preferences > Security & Privacy > General has a section at the bottom for app developer identity settings and also reports any recent related service denials. This is where you will find the coveted Allow Anyway button:

an alert about the recent refusal to trust that service and a button to allow it

Click that and run mongod in terminal again. You'll get a new security dialog with an Open button. Click it and mongo is back in the trust circle.

new alert with option to run the unrecognized mongo software

0

/ SOLVED /

I got this solved just by running mongo in the command line with super user permissions, so prepending sudo (Super User DO).

sudo mongo

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .