For example install MondoDB 2.6.12 on macOS Catalina
-
Download, extract and move:
wget http://downloads.mongodb.org/osx/mongodb-osx-x86_64-2.6.12.tgz
tar xzf mongodb-osx-x86_64-2.6.12.tgz
mv mongodb-osx-x86_64-2.6.12/ /usr/local/mongodb/
-
Add to file
~/.zshrc
this:export PATH="$PATH:/usr/local/mongodb/bin"
PS:
.bash_profile
or.profile
not worked in my case -
Mkdir directory for data and set rights:
mkdir -p ~/data/db
chown -R mongodb.mongodb ~/data/db
-
Run MongoDB:
mongodb --dbpath ~/data/db