How to Install MongoDB on Mac | Install MongoDB on macOS
Вставка
- Опубліковано 10 лют 2025
- 🍏📦 *No Homebrew Needed: How to Install MongoDB on Mac (M1, M2, M3, MacBook Pro, MacBook Air) Without Homebrew and Configure in Zsh!* 🚀🖥️
If you prefer not to use Homebrew, you can manually download and install MongoDB on your Mac. Additionally, we'll cover setting up MongoDB in the Zsh shell.
🌟 *Step-by-Step Guide:*
1. *Download MongoDB:*
Visit the official MongoDB website (www.mongodb.co...) and download the MongoDB Community Server for macOS.
2. *Extract the Archive:*
Once the download is complete, locate the downloaded file (usually a .tgz or .tar.gz archive) and extract it. You can do this by double-clicking on the file or using the terminal:
```bash
tar -zxvf /path/to/downloaded/mongodb-osx-ssl-x86_64-4.x.x.tgz
```
3. *Move MongoDB to /usr/local:*
Move the extracted MongoDB folder to `/usr/local` for easier access:
```bash
sudo mv mongodb-osx-ssl-x86_64-4.x.x /usr/local/mongodb
```
4. *Create Data Directory:*
MongoDB requires a data directory. Create one using:
```bash
sudo mkdir -p /usr/local/var/mongodb
```
5. *Set Permissions:*
Set proper permissions for the data directory:
```bash
sudo chown -R $(whoami) /usr/local/var/mongodb
```
6. *Add MongoDB Binaries to PATH:*
To access MongoDB from any location in the terminal, add the MongoDB binaries to your shell's PATH. If you're using Zsh, edit your Zsh configuration file (usually `~/.zshrc`):
```bash
nano ~/.zshrc
```
Add the following line at the end:
```bash
export PATH="/usr/local/mongodb/bin:$PATH"
```
Save and exit.
7. *Restart Zsh or Source the Configuration:*
Restart Zsh or source the updated configuration:
```bash
source ~/.zshrc
```
8. *Start MongoDB:*
Start MongoDB by running:
```bash
mongod --dbpath /usr/local/var/mongodb
```
9. *Verify Installation:*
Open a new terminal window and run the MongoDB shell:
```bash
mongo
```
You should see the MongoDB shell prompt.
10. *Explore MongoDB:*
You're ready to explore MongoDB! Use commands like `show dbs` and `use your_database_name` to get started.
11. *Stop MongoDB (Optional):*
If you want to stop MongoDB, press *Ctrl + C* in the terminal where MongoDB is running.
🚀 *Additional Tips:*
*Configure MongoDB as a Service (Optional):*
To run MongoDB as a service, create a launch agent plist file. Refer to the MongoDB documentation for detailed instructions.
*Upgrade MongoDB Version:*
To upgrade MongoDB, download the latest version, repeat the installation steps, and replace the old binaries.
🍃 *Congratulations! You've successfully installed MongoDB on your Mac without Homebrew and configured it to work seamlessly with Zsh!*
🍃 *Hashtags:*
#MongoDB #MacOS #DatabaseInstallation #TechTutorial #NoHomebrew #ZshConfiguration #DevelopmentEnvironment #ManualInstallation #TechHowTo
I was frustrated to install Mongodb on Mac but this video makes it so simple. Thanks for making
I had to run brew install mongodb-community@7.0 and continue from 5:00. Thank you, it was helpful!
woah you saved my coding journey. such a complex installation of mongodb in mac explained in a simple step by step manner. Thanks :)
Thank you so much! this saved my life.
At 8:45 if your 'ls' ,'mkdir' or any other commands don't work, just copy paste the following in your .zshrc file and save -
export PATH="/usr/local/bin:/usr/bin:/bin:/usr/sbin:/sbin"
thankksss
well, this was really helpful. homebrew and apple has stopped caring about my old macbook pro. I could not get mangodb running like I've always been used to so this was a life saving alternative. thank you much!
I was struggling with installation of MongoDB, you have solved problem like that. Amazing man.
Hi! I just wanted to say thank you so much for this tutorial. I have been struggling for days trying to figure out why my mongod was not working properly when installing with homebrew. I decided to install it the way you suggested and woah- the error was gone! Thanks again for being a lifesaver!
After Searching for an hour, then your video help me alot thanks for this video
budddy love you you dont knwo how much i feel for you after running my mongo
This is my first comment on youtube just for you amazing explanation sir. Just looking like a wao.
Very well prepared video step by step. Big Thanks for contributing to the community
this is the video i have been looking for for months thank you~~~
Thank you for this! I can assure you that it's working.
Muchas muchaas gracias, soy de Colombia y me sirvió mucho el tutorial. Exactamente lo que buscaba 💯
x2
Thank you so much! This was a helpful and easy to follow tutorial. Very appreciated ❤
Thank you for the video! Steps were very easy to follow and you went at a great pace.
Steps were very easy to follow. thanks.
Very nice video , It helped , stuck for long time , finally it worked , Thanks man
Thanks for the step by step details to install mongodb in mac system. Very nicely explained.👌
Thanks for your instructions i would able to easily install mongodb🎉🎉
"Thanks a lot! This was really helpful for me and other users. Awesome blog video, thanks again!"
Thank you so much sir. plz keep it up😊
They should pay you to have this next to their download page. thank you!
Excellent my friend! It worked flawlessly.
Its possible some people have server is still running when they close the terminal and Cannot use anything else
Just run command in terminal
Ps aux | grep mongod
See if any processes are still running for mongodb and note down the process ids(typically pids are 5 digits in second column)
And Next command-
Sudo kill -9
Then force close and reopen and check it shall be working
Thank you so much. You save my day :)
Lazawaab , maza aagaya
every step goes so smoothly
thank you so much
do you know how do i start mongodb compass next time. I mean i followed each step it works .now im simply opening compass again error occured. do i need to do something in terminal each time i open compass?
Fantastic video, thanks for the help!
Thanks. I installed it with home brew following the instructions on MongoDB website. Any difference?
Thank you for this tutorial.
made installation simple, thanks
this video is super helpful
Thank you, It was so helpful
Thanks this helped a lot
Detailed instructions. Thanks!!
thankyou so much , very helpful
Thank you so much... this was fantastic. Very thorough too.
Thank you! Thank you! Thank you!
Hi, thank you for the video it helped me a lot !!!!!!!
It helped, Thank you!
Hello, could you please make a video on what are the options for running C# and dotnet in silicon chip based macs as microsoft has stopped the support for visual studio for macOS
Thankyou so much, that video is really helpful
really a very helpful video
Thanks, you're a lifesaver
Thanks you very much. Your video helps me
Good explaination
Thank you for the video
suoerb video.. Very well explained. Help me setup my mongo on mac
Bro gracias, probablemente no entiendas esto pero te quiero
Thank you Thank you Thank you!!!
thank you so much man i was going to throm is mac opreators just frustrated the hell out of me man
GOAT tutorial
Awesome video!
i have M1 macbook, which community server version should i download?
Great video
great! easy ) thanks
Thank you very much!
excellent, very helpful
Thank you soo much :)
bhai crazy hai tu
Thanks bro !
How to configurate the user and permissions locally, u would make a video?
very useful
Thank you!
gracias,me sirvio!
Thank you !!!
thanks, it worker fine
downloaded as mentioned but on terminal when giving command cd downloads the file is not showing up. how to proceed ?
thanks a lot
in export path = what should be the {PATH} and from where I can set that value in mac. I am new to the mac please help
Hello sir , i am having issue with this command which is sudo mongo -dbpath==/User/MacBook/data/db its showing me a pop-up message that includes mongo D cannot be opened because Apple cannot check it for malicious software. The software needs to be updated, contact developer for more information what to do please help me
same problem
Go to system preferences->security & privacy -> General and enable changes on this tab by clicking on the locker in the bottom of the page. Then allow mongod to be opened on your mac
I am sure this is a silly question, but here I go anyway : Is it necessary to have Mongo DB Shell installed as a requirement to install and run Mongo DB Compass?...
in my mac it shows me a error to contact developer and says that the apple cannot scan this for malicious software
just go to system preferences > Privacy & Security > scroll down and click "allow anyways" mongod
Thanks!
thank you
At 8:03 my mongod command isn’t working, it says:
‘“mongod” can’t be opened because Apple cannot check it for malicious software. This software needs to be updated. Contact the developer for more information.’ And it gives me two options, “Show in Finder” and “OK”
What the hell do I do?
after running the command, just open your system preferences then go to privacy and security scroll down and then you can see mongod will be blocked, just click on allow there and other steps will work as you move through the video!
Hello, I have a question how do I access mongosh in a different terminal window? it says zsh: command not found: mongosh, do I have to do the downloading process over again? Thanks!
Thank u !!!!!
Saver video again!!!
After closing the connection with Mongod terminal will the compass work or do I have to keep it running in the background to work on the compass?
感謝します。
Thankyou
How to restart server after successful installation
give me the command for restart the mongodb server by any chance if it get closed
after someday, if we want to try to open mongo db compass , it shows an error while connecting i.e ECONNREFUSED like this? why?
how did you fix it??????
@@rajatpanwal Yes , it is fixed now , we have to use that last command in our terminal.
kral ya kral
please help it is showing me
“mongod” can’t be opened because Apple cannot check it for malicious software.
System settings -> security and privacy -> allow apps to download from appstore
hello can anyone tell me how to install mongo db shell on M1 CHIP , it's giving me a lot of issues
What? A quarter of the way through the 21st Century and the mongodb software is straight out of the '80s. Can't believe any Mac owner would use it.
after following your video instructions for installing Mongodb my terminal is not working. Thank you
Mine too
Mine too. Please tell how did u fix it. Please
😢😢
Yeah, can anyone please help me how to do it
@@togariakshath29 guys, is it the same error as in my comment? If anyone got the same, please help me, I have an exam after tomorrow and I need mongo to work
hey i am not getting mongoshell option even it is enable to intract
touch: .zshrc: Permission denied.... can anyone give me a solution for this??
Hi
My .zshrc file is locked because there is anaconda codes. So I can't paste the path there. Any solution for this issue?
did you find the solution?
Just curious, has anyone ever gotten mongodb to work on a mac - without compass?
way of in your mac system And way of in my mac are different 😟
so it was difficult for me 🤯
because i am beginner 😊
Wow, u managed to make this waaaaay more complicated than it needs to be
bro how to stop the services running i have 2 services running how to stop them
command not found is coming when I run mongod after running source .zshrc and clear
did you fingd the solution
indians are saviours
there is an error saying "mongod" cant be opened becuase apple cannot check it for malicious software -this software neeeds to be updated. contact the developer for more information 'what should i do now"
for this issue click on apple icon-> go to system setting-> security and privacy-> scroll down you'll see something like "mongod" something click on "open anyway"