4

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?

4 Answers4

4

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!

buddemat
  • 4,552
  • 14
  • 29
  • 49
  • 1
    You just saved my laptop, I was about to throw it off of the balcony.... This was on a FRESH install of homebrew, and it doesnt work out of the box, and no notes on their website about this potential issue [Jackie Chan wtf face] – Siavash Dec 22 '22 at 07:55
  • Glad this helped! – Alyssa De Metro Feb 08 '23 at 21:13
2

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.

2

I was also having the same issue. This solved it for me:

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

brew update

brew upgrade

brew upgrade --cask

brew cleanup

Then install the latest version of Mongodb community using:

brew install mongodb-community@6.0

Note: version might be outdated at the time you're reading this

iykethe1st
  • 71
  • 4
0
  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.

zswqa
  • 826
  • 5
  • 15