How to have two different versions of MongoDB installed at same time? Is it possible to install both mongodb 2.6 and 3.2 on the same Mac?  I’ve been using mongodb 3.2 (Installed with homebrew) for a while but needed to install 2.6 to support an older project.  I used brew install homebrew/versions/mongodb26 and got some issues with conflicting files, which I could sort out later.

Possible conflicting files are:
/usr/local/bin/bsondump -&gt; /usr/local/Cellar/mongodb/3.2.10/bin/bsondump
/usr/local/bin/mongo -&gt; /usr/local/Cellar/mongodb/3.2.10/bin/mongo
/usr/local/bin/mongod -&gt; /usr/local/Cellar/mongodb/3.2.10/bin/mongod
/usr/local/bin/mongodump -&gt; /usr/local/Cellar/mongodb/3.2.10/bin/mongodump
/usr/local/bin/mongoexport -&gt; /usr/local/Cellar/mongodb/3.2.10/bin/mongoexport
/usr/local/bin/mongofiles -&gt; /usr/local/Cellar/mongodb/3.2.10/bin/mongofiles
/usr/local/bin/mongoimport -&gt; /usr/local/Cellar/mongodb/3.2.10/bin/mongoimport
/usr/local/bin/mongooplog -&gt; /usr/local/Cellar/mongodb/3.2.10/bin/mongooplog
/usr/local/bin/mongoperf -&gt; /usr/local/Cellar/mongodb/3.2.10/bin/mongoperf
/usr/local/bin/mongorestore -&gt; /usr/local/Cellar/mongodb/3.2.10/bin/mongorestore
/usr/local/bin/mongos -&gt; /usr/local/Cellar/mongodb/3.2.10/bin/mongos
/usr/local/bin/mongosniff -&gt; /usr/local/Cellar/mongodb/3.2.10/bin/mongosniff
/usr/local/bin/mongostat -&gt; /usr/local/Cellar/mongodb/3.2.10/bin/mongostat
/usr/local/bin/mongotop -&gt; /usr/local/Cellar/mongodb/3.2.10/bin/mongotop


But if I try to start mongod, by running /usr/local/Cellar/mongodb/3.2.10/bin/mongod I get the error 2016-11-15T14:26:08.132+0000 [initandlisten] exception in initAndListen: 28574 Cannot start server. Detected data files in /data/db created by storage engine 'wiredTiger'. The configured storage engine is 'mmapv1'., terminating.

I’ve also lost my database for 3.2, which appears to have been overwritten while installing 2.6.

Has anyone got this working?
I know this is an old question but I was looking for a way to have version 4.x and 3.x and found this to be the easiest solution.

Install the versions of MongoDB you want with brew.

You can find which versions are available with brew search mongo. If you don't see the version you want run brew update. I'm installing the latest version (4) and version 3.6:

brew install mongodb
brew install mongodb@3.6


Start the version you want with brew service

brew services start mongodb


Switch to a different version:


Make sure you are backwards compatible: 

mongo --eval 'db.adminCommand({setFeatureCompatibilityVersion: "3.6"})'
Stop mongod:

brew services stop mongodb
Unlink the current version of MongoDB:

brew unlink mongodb
Link the new version of MongoDB:

brew link --force mongodb@3.6
Start MongoDB version 3.6:

brew services start mongodb@3.6
Check your version:

mongo --version