Running into problems installing MongoDB on MacOS Terminal

Viewed 4350

I am trying to install mongoDB as a macOS service but I am running to some errors

  1. I first put in the terminal

    brew tap mongodb

Nothing really happens.

  1. But, when I run:

brew install mongodb-community@5.0

I receive:

Warning: No available formula with the name "mongosh" (dependency of mongodb/brew/mongodb-community). Did you mean mongocli?

==> Searching for similarly named fo This similarly named formula was found: mongocli ✔

To install it, run: brew install mongocli ✔ It was migrated from mongodb/brew to homebrew/core.

  1. Finally, when I run

brew services start mongodb-community@5.0

I receive

Error: Formula 'mongodb-community' is not installed.

Any advice?

3 Answers

I am experiencing the exact same problem (I am using MacOC version 11.5.1).

The reason why your brew tap mongodb does not seem to be doing anything may be because you have already tapped into mongodb. Try untapping with brew untap mongodband retapping with brew tap mongodb/brew.

After you have established the connection, try installing again with brew install mongodb-community@5.0. At this stage, I could not get the installation to work for version 5.0 so I installed version 4.4 instead (with brew install mongodb-community@4.4).

After that, try running mongo with brew services start mongodb-community@5.0 (or brew services start mongodb-community@4.4 if you have installed 4.4 version) and it should work just fine!

If you have installed version 4.4, be sure to run the command PATH="/usr/local/opt/mongodb-community@4.4/bin" mongo to start the mongo shell.

I had the same happen, however my issue was actually with this error:

fatal: could not solve HEAD to a revision

solve it using:

git -C $(brew --repository homebrew/core) checkout master

you can also:

brew update

brew upgrade

brew upgrade --cask

brew cleanup

and then restart the mongodb community edition install process again! Worked for me!

  1. Check with brew list | grep mongo that mongodb-community, mongodb-database-tools, mongosh exist at your PC. If they do not exist, install them with brew.

  2. Recently also installed mongodb V4.4.5 and can not start it with brew services start mongodb-community. For me works starting it manually as a background process as admin sudo mongod --config /usr/local/etc/mongod.conf --fork

  3. And last call mongo to work with mongoDB shell.

Reason: directory/file access issue. Not sure.

Related