Zsh: bad CPU type in executable: mongod

Hi,

I am seeing that Mongodb installation documents are now updated For macOS running on Apple M1 processors. But I am still facing issue when installing with brew.
Can anyone help me with this ?

brew services list                                         
19968
Name                  Status  User   File
mongodb-community@4.4 error

and

zsh: bad CPU type in executable: mongod

Thanks in Advance.

Welcome to the MongoDB Community Forums @Raghav_Sharma !

Available MongoDB server binaries for macOS are currently Intel x86_64 only (not native arm64 for M1), so will require you to have Rosetta 2 Intel emulation installed.

Regards,
Stennie

HI @Stennie_X , Is there any particular reason why the user docs are updated with M1 installation steps but not binaries ?

Hi @Raghav_Sharma,

Native Apple Silicon support for MongoDB server has been waiting on some upstream dependencies which are gradually being unblocked: Support for Apple M1 Silicon? - #2 by Stennie.

If you are interested you could follow SERVER-50115: arm64/aarch64 support for macOS which has been blocked waiting on a MozJS ESR (Extended Support Release) for the embedded JavaScript engine: SERVER-42427: Upgrade MozJS/Spidermonkey to ESR 91.

MozJS ESR 91 is now available so we can start on the engineering work for platform compatibility, but there is a non-trivial amount of development & testing involved in supporting the new platform architecture and required dependency updates.

Apple anticipated these issues in their architecture change and provides Rosetta 2 so you are able to run Intel binaries during the transition period. I have been using Intel MongoDB server binaries on M1 for my own development and testing since the beginning of this year and Rosetta has been working great.

Regards,
Stennie

Hey @Raghav_Sharma , is your issue resolved on installing rosetta 2 intel emulation?
i have been facing the same issue!

Hi @Saikiran_k,

Yes, installing Rosetta 2 emulation will allow you to run the Intel MongoDB binaries. I’m using this myself :slight_smile:

Regards,
Stennie

Hey @Stennie_X , now i have got a new issue with the rosetta 2.
initially it worked for me too , i have installed the rosetta 2 and ran the `brew services start mongodb-community@5.0’
it started the mongodb-community.
but after i have and started it again… it again throws me the same error,
Name Status User File
mongodb-community error saikiran

i tried again this ===> softwareupdate --install-rosetta
but now it says ==>. 2021-11-28 11:17:55.726 softwareupdate[12679:88063] Package Authoring Error: 002-23768: Package reference com.apple.pkg.RosettaUpdateAuto is missing installKBytes attribute
Install of Rosetta 2 finished successfully.

saikiran@saikirans-MacBook-Air ~ % brew services start mongodb-community@5.0

Bootstrap failed: 5: Input/output error

Try re-running the command as root for richer errors.

Error: Failure while executing; /bin/launchctl bootstrap gui/501 /Users/saikiran/Library/LaunchAgents/homebrew.mxcl.mongodb-community.plist exited with 5.

how can i proceed now… its consuming all of my time :expressionless:

Hi @Saikiran_k,

Rosetta is a one-off installation, so if this worked for you previously there should be no need to reinstall.

This is a different error from one originally mentioned in this discussion topic: this error indicates that brew services was unable to successfully start the MongoDB service.

A few suggestions:

  • Check if there is already a running mongodb-community service started by brew:

    brew services list

  • If brew services list doesn’t show the service as started, check if there is another mongod running in the background:

    ps auwx | grep mongod | grep -v grep

  • Check the last MongoDB startup error message with:

    grep “errmsg” $(brew --prefix)/var/log/mongodb/mongo.log | tail -1

  • If the above grep doesn’t return a useful hint:

    less $(brew --prefix)/var/log/mongodb/mongo.log

    While in less, use <spacebar> to view the next page, <b> to go back, or <q> to exit. There should be an error message message indicating why the mongod process failed to start.

Regards,
Stennie

This topic was automatically closed 5 days after the last reply. New replies are no longer allowed.