


If you enjoyed this article, please support me by sharing this article Twitter or buying me a coffee đ. If you havenât already, you should learn how to set up a local MongoDB connection. Here are my aliases: alias mongod='brew services run mongodb-community'ÄȘlias mongod-stop='brew services stop mongodb-community' I created some aliases to make things easier for me. Itâs a chore typing brew services run mongodb-community every time I want to start MongoDB. Homebrew will stop MongoDB and let you know. Use this command: brew services stop mongodb-community If MongoDB is running, you should be able to access the Mongo shell with the mongo command.

If MongoDB is running, mongodb-community will have a status set to started. I prefer run since I donât want MongoDB to be running all the time. start will start MongoDB automatically when you login into your Macbook. MongoDB will start as a background service. Use this command: brew services run mongodb-community The best way to start MongoDB now is via brew services. This no longer works out for the box from MongoDB v4.2.3 onwards. In the past, I can run the mongod command to start MongoDB. Then, use this command to give permissions: sudo chown -R `id -un` /System/Volumes/Data/data/db Use this command: sudo mkdir -p /System/Volumes/Data/data/db If youâre on Catalina, you need to create the /data/db folder in System/Volumes/Data. Preparations (MacOS Catalina onwards)ÄȘpple created a new Volume in Catalina for security purposes. Now you can follow the rest of the article to set up your MongoDB connection. You also need to give permissions to use it: sudo chown -R `id -un` /data/db You can create this folder with the following command: sudo mkdir -p /data/db Preparations (Before MacOS Catalina)Ä«efore you can use MongoDB, you need to create a /data/db folder on your computer to use MongoDB. MongoDB is now installed on your computer. If youâre curious about what Homebrew is, read this article. Hereâs an updated version on how to install MongoDB on a Mac.ÄŻirst, you install Homebrew. During the reconfiguration period, I noticed the instructions I linked to in âSetting up a local MongoDB connectionâ were outdated. I had to reconfigure my Macbook after sending it for repairs. Installing MongoDB on Mac (Catalina and non-Catalina) 14th Feb 2020
