Problem with mongodb installation mac using homebrew

I tried to install the
5.0 community version using homebrew. This is the error that I get.

I tried to downgrade to version 4.4. I started mongo via terminal it works, but it does not recognize the ‘mongo’ command in the terminal. T

I will be glad to get some help :smile:

Hello Eitan,

Welcome to the MongoDB community.

This is somewhat amusing to a point, as I’ve literally spent the past few days working with MongoDB through the Home-brew, and Docker Images. lol

So yes, 5.0 may have issues installing on your Mac through home-brew, because you have an M1 Mac. A work around is definitely 4.4 due to SSE issues in 5 pertaining to AVX, but if you’re not using virtualization such as Docker this may not be the case.

Now for your main issue of getting 4.4 to work, this is what I did/do (I have an M1 MacBook Pro that I just love to use for tests and things like this, too.)

xcode-select --instal Because you need the Xcode tools.
brew tap mongodb/brew
brew install mongodb-community@4.4.1
brew services start mongodb-community@4.4.1

We have the documentation located here: https://docs.mongodb.com/manual/tutorial/install-mongodb-on-os-x/

But I do recommend that instead of doing it this way as it sounds like you’re setting up a test environment. I would pursue further evolving your knowledge and DevOps skills by implementing your MongoDB images on your Mac with Docker images. And learning how to use Docker alongside MongoDB, as well as other ways how to implement and orchestrate containerized virtualization.

This method also makes it substantially faster and easier to setup and tear down applets and micro services that you construct.

https://hub.docker.com/_/mongo

Note:

  • You can use any 4.4 variety, I just happened to pick 4.4.1.
  • To connect to Docker image run: docker run -p 27018:27017 and then use compass and connect to your MongoDB docker image through Port 27017 or whatever port that you set it to.

Note2: This is a method that has gotten 5 to work on an M1 Mac by doing the following:

ls -l /tmp/mongodb-27017.sock
sudo rm -rf /tmp/mongodb-27017.sock
brew services start mongodb-community
brew services list

Note3: Depending on system configs and any scripts that you have going for graceful failovers, double check the MongoDB version installed on your system after you have it running.

Note4: The main steps to install via Brew that I did on my M1 MacBook Pro are the following.

brew tap mongodb/brew
brew install mongodb-community@5.0
brew services start mongodb-community 

If there is anything else for which I can be of assistance, please feel free to ask.

Regards,

Brock

A post was split to a new topic: Error installing with Homebrew: Your Xcode (14.0.1) is too outdated