After migrating my old MacBook Pro to a new machine via the Migration Assistant, I am unable to connect to MongoDB.

I re-installed it via Homebrew, and when I run:

brew services start mongodb-community

Terminal states that the service started, however, when I run: mongo

I get this error:

MongoDB shell version v3.4.9
connecting to: mongodb://
2020-04-09T09:20:02.419-0400 W NETWORK  [thread1] Failed to connect to, in(checking socket for error after poll), reason: Connection refused
2020-04-09T09:20:02.419-0400 E QUERY    [thread1] Error: couldn't connect to server, connection attempt failed :

I was following this guide on Medium: https://medium.com/better-programming/installing-mongodb-on-macos-catalina-aab1cbe0c836

to re-install MongoDB. Can anyone help me out?


Did you reinstall brew after migration? I had lots of problems after upgrade to Catalina. However on fresh Catalina (and brew default installation) I:

  1. brew tap mongodb/brew
  2. brew install mongodb-community
  3. brew services start mongodb-community
  4. ==> Successfully startedmongodb-community`

You can try to:

  1. download Xcode command line
  2. restart
  3. clear cellar folder and brew cache
  4. brew tap mongodb/brew

or full brew reinstall and follow 1-4.

  • 1
    I get exactly the same error, even after completely un-installing Homebrew, re-installing Homebrew and MongoDB Community. It will start the server, but not allow me to connect.
    – Brandon
    Apr 17 '20 at 14:00
  • 1
    Well, it's strange, but after restarting my Mac and then restarting the service, I was able to connect.
    – Brandon
    Apr 17 '20 at 15:04
  • That's why they call it "Crapalina" ;)
    – Marek Ka.
    Apr 21 '20 at 14:59

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.