HELP: Brew mongodb-community@5.0 error [MacOS]

Hello
I am having hard time setting up mongo db server.

Process:

When I start the database by brew services start mongodb-community@5.0, it does not give me any error message. However, when I look at the status, it is showing an error status, without any reason. Because of this, I cannot connect to the database (using mongo command).

I am using M1 mac but with Rosetta terminal and homebrew for intel macs (you can see that install location is /usr/local, not /opt/homebrew).

I also tried downgrading to v4.4 or use M1 version of Mongodb but I get the same error.

I spent a few hours googling for answers but none worked.
I really need help.

Thanks.

Welcome to the MongoDB Community Forums @REGO350 !

I think that should be OK as long as brew --prefix reports /usr/local and the right substitutions were made in /usr/local/etc/mongod.conf.

Can you check the MongoDB logs for errors. Something like this should show you the last lines in the log:

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

I have MongoDB 5.0 installed on an M1 via brew, but when I installed Homebrew it used the preferred default prefix of /opt/homebrew.

Regards,
Stennie

@Stennie_X

Thank you for the quick reply.
This is what I for opt/homebrew:

{"t":{"$date":"2021-09-27T13:37:42.239+09:00"},"s":"I",  "c":"REPL",     "id":5123008, "ctx":"main","msg":"Successfully registered PrimaryOnlyService","attr":{"service":"TenantMigrationDonorService","ns":"config.tenantMigrationDonors"}}
{"t":{"$date":"2021-09-27T13:37:42.239+09:00"},"s":"I",  "c":"REPL",     "id":5123008, "ctx":"main","msg":"Successfully registered PrimaryOnlyService","attr":{"service":"TenantMigrationRecipientService","ns":"config.tenantMigrationRecipients"}}
{"t":{"$date":"2021-09-27T13:37:42.239+09:00"},"s":"I",  "c":"CONTROL",  "id":4615611, "ctx":"initandlisten","msg":"MongoDB starting","attr":{"pid":50463,"port":27017,"dbPath":"/System/Volumes/Data/data/db","architecture":"64-bit","host":"Mac-mini.local"}}
{"t":{"$date":"2021-09-27T13:37:42.239+09:00"},"s":"I",  "c":"CONTROL",  "id":23351,   "ctx":"initandlisten","msg":"{sysctlName} unavailable","attr":{"sysctlName":"machdep.cpu.extfeatures"}}
{"t":{"$date":"2021-09-27T13:37:42.239+09:00"},"s":"I",  "c":"CONTROL",  "id":23403,   "ctx":"initandlisten","msg":"Build Info","attr":{"buildInfo":{"version":"5.0.2","gitVersion":"6d9ec525e78465dcecadcff99cce953d380fedc8","modules":[],"allocator":"system","environment":{"distarch":"x86_64","target_arch":"x86_64"}}}}
{"t":{"$date":"2021-09-27T13:37:42.239+09:00"},"s":"I",  "c":"CONTROL",  "id":51765,   "ctx":"initandlisten","msg":"Operating System","attr":{"os":{"name":"Mac OS X","version":"20.6.0"}}}
{"t":{"$date":"2021-09-27T13:37:42.239+09:00"},"s":"I",  "c":"CONTROL",  "id":21951,   "ctx":"initandlisten","msg":"Options set by command line","attr":{"options":{"config":"/opt/homebrew/etc/mongod.conf","net":{"bindIp":"127.0.0.1"},"storage":{"dbPath":"/System/Volumes/Data/data/db"},"systemLog":{"destination":"file","logAppend":true,"path":"/opt/homebrew/var/log/mongodb/mongo.log"}}}}
{"t":{"$date":"2021-09-27T13:37:42.241+09:00"},"s":"E",  "c":"NETWORK",  "id":23024,   "ctx":"initandlisten","msg":"Failed to unlink socket file","attr":{"path":"/tmp/mongodb-27017.sock","error":"Permission denied"}}
{"t":{"$date":"2021-09-27T13:37:42.241+09:00"},"s":"F",  "c":"-",        "id":23091,   "ctx":"initandlisten","msg":"Fatal assertion","attr":{"msgid":40486,"file":"src/mongo/transport/transport_layer_asio.cpp","line":960}}
{"t":{"$date":"2021-09-27T13:37:42.241+09:00"},"s":"F",  "c":"-",        "id":23092,   "ctx":"initandlisten","msg":"\n\n***aborting after fassert() failure\n\n"}

And for /usr/local:

{"t":{"$date":"2021-09-27T13:33:19.136+09:00"},"s":"W",  "c":"ASIO",     "id":22601,   "ctx":"main","msg":"No TransportLayer configured during NetworkInterface startup"}
{"t":{"$date":"2021-09-27T13:33:19.136+09:00"},"s":"I",  "c":"NETWORK",  "id":4648602, "ctx":"main","msg":"Implicit TCP FastOpen in use."}
{"t":{"$date":"2021-09-27T13:33:19.139+09:00"},"s":"I",  "c":"STORAGE",  "id":4615611, "ctx":"initandlisten","msg":"MongoDB starting","attr":{"pid":49186,"port":27017,"dbPath":"/usr/local/var/mongodb","architecture":"64-bit","host":"Mac-mini.local"}}
{"t":{"$date":"2021-09-27T13:33:19.139+09:00"},"s":"I",  "c":"CONTROL",  "id":23351,   "ctx":"initandlisten","msg":"{sysctlName} unavailable","attr":{"sysctlName":"machdep.cpu.extfeatures"}}
{"t":{"$date":"2021-09-27T13:33:19.139+09:00"},"s":"I",  "c":"CONTROL",  "id":23403,   "ctx":"initandlisten","msg":"Build Info","attr":{"buildInfo":{"version":"4.4.8","gitVersion":"83b8bb8b6b325d8d8d3dfd2ad9f744bdad7d6ca0","modules":[],"allocator":"system","environment":{"distarch":"x86_64","target_arch":"x86_64"}}}}
{"t":{"$date":"2021-09-27T13:33:19.140+09:00"},"s":"I",  "c":"CONTROL",  "id":51765,   "ctx":"initandlisten","msg":"Operating System","attr":{"os":{"name":"Mac OS X","version":"20.6.0"}}}
{"t":{"$date":"2021-09-27T13:33:19.140+09:00"},"s":"I",  "c":"CONTROL",  "id":21951,   "ctx":"initandlisten","msg":"Options set by command line","attr":{"options":{"config":"/usr/local/etc/mongod.conf","net":{"bindIp":"127.0.0.1"},"storage":{"dbPath":"/usr/local/var/mongodb"},"systemLog":{"destination":"file","logAppend":true,"path":"/usr/local/var/log/mongodb/mongo.log"}}}}
{"t":{"$date":"2021-09-27T13:33:19.142+09:00"},"s":"E",  "c":"NETWORK",  "id":23024,   "ctx":"initandlisten","msg":"Failed to unlink socket file","attr":{"path":"/tmp/mongodb-27017.sock","error":"Permission denied"}}
{"t":{"$date":"2021-09-27T13:33:19.142+09:00"},"s":"F",  "c":"-",        "id":23091,   "ctx":"initandlisten","msg":"Fatal assertion","attr":{"msgid":40486,"file":"src/mongo/transport/transport_layer_asio.cpp","line":919}}
{"t":{"$date":"2021-09-27T13:33:19.142+09:00"},"s":"F",  "c":"-",        "id":23092,   "ctx":"initandlisten","msg":"\n\n***aborting after fassert() failure\n\n"}

Could be permission issues
Check ownership of /tmp/mongodb-27017.sock
Try to remove this file and start the service again

1 Like
> ls -l /tmp/mongodb-27017.sock
srwx------  1 root  wheel  0 Sep 27 10:55 mongodb-27017.sock
> sudo rm -rf /tmp/mongodb-27017.sock
> brew services start mongodb-community
> brew services list
Name              Status  User    Plist
mongodb-community started riomain /Users/riomain/Library/LaunchAgents/homebrew.mxcl.mongodb-community.plist

Oh wow! Thank you!!! It’s finally working!

2 Likes

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