TransWikia.com

MongoDB doesnt' work after update to macOS Catalina 10.15

Ask Different Asked by zpeters on October 30, 2021

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?

17 Answers

Update brew, install mongodb community version, create a new directory outside root since >=catalina apple wont let you put data in the root directory then update your mongo conf.

sudo mkdir -p /System/Volumes/Data/data/db
sudo chown -R `id -un` /System/Volumes/Data/data/db

brew uninstall mongodb
brew tap mongodb/brew

brew install mongodb-community

nano /usr/local/etc/mongod.conf

When the nano opens change the path change dbPath /System/Volumes/Data/data/db

Add some alias's if you want to get fancy.

alias mongod='brew services run mongodb-community'
alias mongod-start='brew services start mongodb-community' #will start MongoDB automatically when you login into your Macbook
alias mongod-status='brew services list'
alias mongod-stop='brew services stop mongodb-community'

Restart your terminal and then voilà you're in there like swim ware.

If you added the alias you can start mongo and check your dbs.

mongod-start
mongo
show dbs

Answered by Christopher Franko on October 30, 2021

I was facing the same problem I had to do two things

  1. allowing mongod and mongo to execute by going through System Preferences > Security & Privacy > General and clicking Allow Anyway

  2. changing the path to db as mongod still failed to start after the allow. the new path is /Users/Shared/Previously Relocated Items/Security/data/db

mongod --dbpath=/Users/Shared/Previously Relocated Items/Security/data/db

Answered by Ahmed on October 30, 2021

You could just remove the quarantine flag from your MongoDB executable files:

xattr -r -d com.apple.quarantine $(dirname $(which mongod))

Answered by anothernode on October 30, 2021

I have tried all the answers above even after that I was getting the same error.

What really worked for me is after navigating to mongodb -> install on macOS: https://docs.mongodb.com/manual/tutorial/install-mongodb-enterprise-on-os-x/#begin-using-mongodb

enter image description here

Answered by Bilal Hussain on October 30, 2021

This page has the BEST instruction on how to install and run on Catalina.

https://zellwk.com/blog/install-mongodb/

Answered by Leonard on October 30, 2021

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.

Answered by Magic Thighs on October 30, 2021

/ 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

Answered by Agustín Marí on October 30, 2021

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

Answered by Cam on October 30, 2021

this can be useful


# install homebrew (https://brew.sh/) and run the following commands
sudo chown -R $(whoami) $(brew --prefix)/*
brew tap mongodb/brew
brew install [email protected]

## --- aliases to set in your zshrc file

# open your zshrc file
open ~/.zshrc
# copy and paste shorcuts in the end of the file
alias mongod='brew services run mongodb-community'
alias mongod-start='brew services start mongodb-community' #will start MongoDB automatically when you login into your Macbook
alias mongod-status='brew services list'
alias mongod-stop='brew services stop mongodb-community'

# restart your terminal
# type mongod in your terminal for run service & mongod-stop for finish it
# test your mongodb connection with
mongo
show dbs

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

Answered by Nicolas Sturm on October 30, 2021

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.

Answered by str8up7od on October 30, 2021

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.

Answered by Bretton Wade on October 30, 2021

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.

Answered by Jim Chie on October 30, 2021

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

Answered by kyrex on October 30, 2021

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.

Answered by Lupurus on October 30, 2021

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

Answered by l2ysho on October 30, 2021

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

Answered by Madhavan Sundararaj on October 30, 2021

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.

Answered by bmike on October 30, 2021

Add your own answers!

Ask a Question

Get help from others!

© 2024 TransWikia.com. All rights reserved. Sites we Love: PCI Database, UKBizDB, Menu Kuliner, Sharing RPP