5

As per the installation instructions, when running:

brew tap mongodb/brew

I get the following error:

Error: Invalid formula: /opt/homebrew/Library/Taps/mongodb/homebrew-brew/Formula/mongocli.rb

formulae require at least a URL

Error: Cannot tap mongodb/brew: invalid syntax in tap!

I do comply with prerequisites (updated xcode and brew). I made sure to run brew update and brew doctor.

At this point, I looked for answers on the mongodb/homebrew-brew repo and saw a very recent commit for the mongocli.

Apparently, it defines URLs for Mac and Linux machines that have Intel chips but no mention of Apple M1 chips. This is blocking me from tapping mongodb at the moment. Would you know of any workaround or am I making a mistake somewhere?

stelloprint
  • 303
  • 2
  • 9

3 Answers3

12

Just had the same problem ...

Go to Finder > Utilities and right click on Terminal and select "Get Info" Find the option "Open using Rosetta" and check it.

Open new Terminal and run "brew tap mongodb/brew" After it completes close the terminal and uncheck "Open using Rosetta", open Terminal again and then run "brew install mongodb-community@4.4".

That worked for me and MongoDB is installed.

Dharman
  • 30,962
  • 25
  • 85
  • 135
markoram
  • 136
  • 1
  • 2
  • 3
    Thanks a lot, that worked. Your answer allowed me to tap mongodb and then install it by avoiding the lack of a formula URL for the mongocli on Apple M1 chips. – stelloprint Feb 26 '21 at 16:35
1

Try the following command

arch -arm64 brew install mongodb-community@4.4
1

You can simply run any command under Rosetta on M1 macs by prefixing the command

arch -x86_64

For your use case try

arch -x86_64 brew tap mongodb/brew 
brew install mongodb-community@4.4  
CodeforCore
  • 675
  • 6
  • 9