Business
Jobs
  • About Us
  • Solutions
    • Job Postings
      Post your job and receive qualified candidates in 48h.
    • Candidate Assessments
      500+ technical and psychological tests, plus anti-fraud.
    • Headhunting
      Tailor-made executive search from start to finish.
    • Payroll + EOR
      Payroll dispersal and EOR across 15+ LATAM countries.
  • Pricing
  • Jobs

0

4.3K
Views
Zsh: Command Not found : mongo After trying to install mongodb 4.2 using brew

I have tried the following steps to install and setup mongodb in my mac from here https://docs.mongodb.com/manual/tutorial/install-mongodb-on-os-x/ but I got the following error when running the final "mongo" command in my terminal:

Error Message - Zsh: Command Not found : mongo

This error msg occurred after trying to install mongodb 4.2 using brew

sudo chown -R $(whoami) $(brew --prefix)/*

then

brew tap mongodb/brew

then

brew install mongodb-community@4.2

and

brew services start mongodb-community@4.2

or

mongod --config /usr/local/etc/mongod.conf

then

ps aux | grep -v grep | grep mongod

and

mongo

running brew services start mongodb-community@4.2 returns:

Successfully started `mongodb-community@4.2` (label: homebrew.mxcl.mongodb-community@4.2)

running ps aux | grep -v grep | grep mongod returns:

9081   0.2  0.5  5528024  41856   ??  S     3:01pm   0:01.48 /usr/local/opt/mongodb-community@4.2/bin/mongod --config /usr/local/etc/mongod.conf

7613   0.0  0.1  4298832   5600 s000  T     2:47pm   0:00.08 vim /usr/local/etc/mongod.conf

running mongod --config /usr/local/etc/mongod.conf returns:

zsh: command not found: mongod

There are also no mongo files in my /usr/local/bin directory after using these commands

I created a data/db folder in my /usr/local/bin directory using the following commands:

sudo mkdir -p  /usr/local/bin/data/db   
sudo chown -R `id -un`  /usr/local/bin/data/db      

Running "brew update" returns:

brew update                                                                                                                                                    
Updated 1 tap (homebrew/cask).
==> Updated Casks
brave-browser
over 4 years ago · Santiago Trujillo
3 answers
Answer question

0

Solved it by manually installing the mongodb community files and db tools using the website instead. Then copying them into /usr/local/bin. Then ignoring the app permissions whenever calling mongo or related commands in the terminal through System Preferences > Security & Privacy > General.

After googling I found out that mongoimport and the other features have to be installed separately: https://www.mongodb.com/try/download/database-tools

Followed by copying those bin files after extracting them into the same /usr/local/bin directory

Not sure why its' not working through homebrew though

over 4 years ago · Santiago Trujillo Report

0

This worked for me, I was having same issue on mongodb-community@4.4

 brew reinstall mongodb-community@4.4  

On terminal something like this will appear during reinstallation.

enter image description here

copy highlighted path with echo

 echo 'export PATH="/opt/homebrew/opt/mongodb-community@4.4/bin:$PATH"' >> ~/.zshrc

Now open another terminal and start mongodb services

brew services restart mongodb/brew/mongodb-community@4.4

write mongo on terminal and here we fly

enter image description here

over 4 years ago · Santiago Trujillo Report

0

If you installed the mongodb via Homebrew. Need to add the mongo path in your bash_profile.

  • Edit the bash_profile vi ~/.bash_profile
  • Add the below line in EOF export PATH=$PATH:/usr/local/opt/mongodb-community@4.2/bin
  • After the edit bash_profile. Close all terminals and open them again. mongo command start works.
over 4 years ago · Santiago Trujillo Report
Answer question
Find remote jobs

Discover the new way to find a job!

Top jobs
Top job categories
Business
Post vacancy Pricing Sales
Legal
Terms and conditions Privacy policy
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Show me some job opportunities
There's an error!