Help mongod command not working in M1 Mac

Hello I have installed Mongo DB in M1 Mac as mentioned in the docs Install MongoDB Community Edition on macOS — MongoDB Manual
But when I try to run mongod command it gives me these errors.

{"t":{"$date":"2022-01-01T16:13:21.271+05:30"},"s":"I",  "c":"CONTROL",  "id":23285,   "ctx":"-","msg":"Automatically disabling TLS 1.0, to force-enable TLS 1.0 specify --sslDisabledProtocols 'none'"}
{"t":{"$date":"2022-01-01T16:13:21.272+05:30"},"s":"I",  "c":"NETWORK",  "id":4915701, "ctx":"-","msg":"Initialized wire specification","attr":{"spec":{"incomingExternalClient":{"minWireVersion":0,"maxWireVersion":13},"incomingInternalClient":{"minWireVersion":0,"maxWireVersion":13},"outgoing":{"minWireVersion":0,"maxWireVersion":13},"isInternalClient":true}}}
{"t":{"$date":"2022-01-01T16:13:21.275+05:30"},"s":"W",  "c":"ASIO",     "id":22601,   "ctx":"main","msg":"No TransportLayer configured during NetworkInterface startup"}
{"t":{"$date":"2022-01-01T16:13:21.275+05:30"},"s":"I",  "c":"NETWORK",  "id":4648602, "ctx":"main","msg":"Implicit TCP FastOpen in use."}
{"t":{"$date":"2022-01-01T16:13:21.276+05:30"},"s":"W",  "c":"ASIO",     "id":22601,   "ctx":"main","msg":"No TransportLayer configured during NetworkInterface startup"}
{"t":{"$date":"2022-01-01T16:13:21.276+05:30"},"s":"I",  "c":"REPL",     "id":5123008, "ctx":"main","msg":"Successfully registered PrimaryOnlyService","attr":{"service":"TenantMigrationDonorService","ns":"config.tenantMigrationDonors"}}
{"t":{"$date":"2022-01-01T16:13:21.276+05:30"},"s":"I",  "c":"REPL",     "id":5123008, "ctx":"main","msg":"Successfully registered PrimaryOnlyService","attr":{"service":"TenantMigrationRecipientService","ns":"config.tenantMigrationRecipients"}}
{"t":{"$date":"2022-01-01T16:13:21.276+05:30"},"s":"I",  "c":"CONTROL",  "id":5945603, "ctx":"main","msg":"Multi threading initialized"}
{"t":{"$date":"2022-01-01T16:13:21.276+05:30"},"s":"I",  "c":"CONTROL",  "id":4615611, "ctx":"initandlisten","msg":"MongoDB starting","attr":{"pid":8149,"port":27017,"dbPath":"/data/db","architecture":"64-bit","host":"Sais-MacBook-Pro.local"}}
{"t":{"$date":"2022-01-01T16:13:21.276+05:30"},"s":"I",  "c":"CONTROL",  "id":23403,   "ctx":"initandlisten","msg":"Build Info","attr":{"buildInfo":{"version":"5.0.4","gitVersion":"62a84ede3cc9a334e8bc82160714df71e7d3a29e","modules":[],"allocator":"system","environment":{"distarch":"x86_64","target_arch":"x86_64"}}}}
{"t":{"$date":"2022-01-01T16:13:21.276+05:30"},"s":"I",  "c":"CONTROL",  "id":51765,   "ctx":"initandlisten","msg":"Operating System","attr":{"os":{"name":"Mac OS X","version":"21.2.0"}}}
{"t":{"$date":"2022-01-01T16:13:21.276+05:30"},"s":"I",  "c":"CONTROL",  "id":21951,   "ctx":"initandlisten","msg":"Options set by command line","attr":{"options":{}}}
{"t":{"$date":"2022-01-01T16:13:21.279+05:30"},"s":"E",  "c":"CONTROL",  "id":20568,   "ctx":"initandlisten","msg":"Error setting up listener","attr":{"error":{"code":9001,"codeName":"SocketException","errmsg":"Address already in use"}}}
{"t":{"$date":"2022-01-01T16:13:21.279+05:30"},"s":"I",  "c":"REPL",     "id":4784900, "ctx":"initandlisten","msg":"Stepping down the ReplicationCoordinator for shutdown","attr":{"waitTimeMillis":15000}}
{"t":{"$date":"2022-01-01T16:13:21.280+05:30"},"s":"I",  "c":"COMMAND",  "id":4784901, "ctx":"initandlisten","msg":"Shutting down the MirrorMaestro"}
{"t":{"$date":"2022-01-01T16:13:21.280+05:30"},"s":"I",  "c":"SHARDING", "id":4784902, "ctx":"initandlisten","msg":"Shutting down the WaitForMajorityService"}
{"t":{"$date":"2022-01-01T16:13:21.280+05:30"},"s":"I",  "c":"NETWORK",  "id":4784905, "ctx":"initandlisten","msg":"Shutting down the global connection pool"}
{"t":{"$date":"2022-01-01T16:13:21.280+05:30"},"s":"I",  "c":"NETWORK",  "id":4784918, "ctx":"initandlisten","msg":"Shutting down the ReplicaSetMonitor"}
{"t":{"$date":"2022-01-01T16:13:21.280+05:30"},"s":"I",  "c":"SHARDING", "id":4784921, "ctx":"initandlisten","msg":"Shutting down the MigrationUtilExecutor"}
{"t":{"$date":"2022-01-01T16:13:21.281+05:30"},"s":"I",  "c":"ASIO",     "id":22582,   "ctx":"MigrationUtil-TaskExecutor","msg":"Killing all outstanding egress activity."}
{"t":{"$date":"2022-01-01T16:13:21.281+05:30"},"s":"I",  "c":"COMMAND",  "id":4784923, "ctx":"initandlisten","msg":"Shutting down the ServiceEntryPoint"}
{"t":{"$date":"2022-01-01T16:13:21.281+05:30"},"s":"I",  "c":"CONTROL",  "id":4784925, "ctx":"initandlisten","msg":"Shutting down free monitoring"}
{"t":{"$date":"2022-01-01T16:13:21.281+05:30"},"s":"I",  "c":"CONTROL",  "id":4784927, "ctx":"initandlisten","msg":"Shutting down the HealthLog"}
{"t":{"$date":"2022-01-01T16:13:21.281+05:30"},"s":"I",  "c":"CONTROL",  "id":4784928, "ctx":"initandlisten","msg":"Shutting down the TTL monitor"}
{"t":{"$date":"2022-01-01T16:13:21.281+05:30"},"s":"I",  "c":"CONTROL",  "id":4784929, "ctx":"initandlisten","msg":"Acquiring the global lock for shutdown"}
{"t":{"$date":"2022-01-01T16:13:21.281+05:30"},"s":"I",  "c":"-",        "id":4784931, "ctx":"initandlisten","msg":"Dropping the scope cache for shutdown"}
{"t":{"$date":"2022-01-01T16:13:21.281+05:30"},"s":"I",  "c":"FTDC",     "id":4784926, "ctx":"initandlisten","msg":"Shutting down full-time data capture"}
{"t":{"$date":"2022-01-01T16:13:21.281+05:30"},"s":"I",  "c":"CONTROL",  "id":20565,   "ctx":"initandlisten","msg":"Now exiting"}
{"t":{"$date":"2022-01-01T16:13:21.281+05:30"},"s":"I",  "c":"CONTROL",  "id":23138,   "ctx":"initandlisten","msg":"Shutting down","attr":{"exitCode":48}}

Do you have another mongod already running?

3 Likes

I’m not sure how can I check it?

As per manual it is recommended to start mongod as service

If you have run brew services start there is no need to start mongod manually.Just issue mongo to connect to your instance

check brew services list

With the shell commands

ps -aef | grep [m]ongod
ss -tlnp

is your issue resolved?? i’m facing the same issue can you help me…!

1 Like

Same issue means error 48?
Please show a screenshot or error logs
Are you trying to start a mongod when there is already a mongod up and running?
You can check with commands given in previous
post above

1 Like

i used mongo to connect instance now its working fine… but i’m getting an error can you help me out

code: db.second.insertone({_id:1,name:“hero”})
erreor : uncaught exception: TypeError: db.second.insertone is not a function :

my bad insert"O"ne. wrong spell, btw how can i connect u through social media…?

I also facing same issue.I’m totally new to mongodb and has no knowledge about it at all.can anybody please help me…
this is the error when i run mongod

Check if your mongod is already up as service
Just issue mongo and see if you can connect
Also check ps -ef | mongod if any mongod is up started manually
Also check permissions on that TMP .sock file

1 Like

can you explain it in a simpler manner

Show us output of
ps -ef|grep mongod and
ls -lrt /tmp/mongod-27017.sock

This is the response i am getting

No mongod running in your case
Have you started the service?
If yes check service status and mongod.log on why it is failing

1 Like