ERRORS: 'mongosh' and 'mongod --config /usr/local/etc/mongod.conf --fork'

I’m having trouble running mongoDB-community@6.0 on my Mac. I’m currently on macOS Monterey Version 12.5.1.

I was able to install mongodb-community@6.0 in my terminal, but I’m running into an issue when I attempt to run the line ‘mongosh’. Here’s an image of my terminal:

I would appreciate any help that you can provide. I’ve been toying with this for a couple days now and can’t seem to get any further than this. Thanks in advance!

Your service is not up
It shows error status
Check mongod.log for errors on why it is failing to start
cat your ~/Library/…/xyz.plist file shown in your screenshot
It will have a config file which has the mongod.log file location

1 Like

From the screenshot, you can see that the MongoDB server starting has failed with an error. You cannot connect to the database without starting the MongoDB server, hence mongosh cannot connect to it. Only, after starting the server successfully you can connect using the mongosh or Compass or from any other program.

1 Like

Can you point me in the right direction on how to start the server? I created an app.js file, initialized npm and started a server on port “27017” using node and nodemon, but I’m still receiving the following error:

From what I’m finding online, it seems I should be connecting to a local deployment simply from following the installation instructions that I had.

Thanks!

Correct.

Follow these instructions and it should work. You can start MongoDB server as a service or manually. After starting the server, connect to it using mongosh. Connecting to MongoDB using mongosh is just typing mongosh at command prompt in the terminal.

Those are the instructions that I followed a few times now, but every time it leads me to this result.

On another thread I saw that Mac no longer creates a /data/db file path so I created one of those, but still receiving this error. Any other ideas on why it can’t connect?

Unless your mongod is up & running you will not be able to connect
Yes on Macos access to root folders is removed
What dirs you created? Can mongod write to those directory?
Does those dirs match with what you have in your mongod.conf file?