Installing MRtrix3 without giving up MRtrix 2.12


I am currently using MRtrix 2.12, which I need to reproduce results from an old pipeline I have. I want to make the transition to MRtrix3, but I still need to be able to use MRtrix 2.12. I was just wondering if it’s possible to install Matrix3 without having to give up MRtrix 2.12. Would the 2 versions conflict somehow? I noticed that both versions have some commands in common, so I’m not sure how that would work.

Your help is appreciated. Thanks!


Sure, I also need to do this all the time, not just between MRtrix 0.2 and 3, but also between different versions of MRtrix3 itself… There’s a few options, but probably the simplest is to only keep one of the versions in your PATH (the one you actually use the most), and invoke the other version by specifying the full path to the executable, or amend the PATH when you need to.

For example, I have MRtrix 0.2 and MRtrix3 installed in the folders mrtrix2 and mrtrix3 respectively within in my home folder. My PATH includes /home/donald/mrtrix3/bin, but nothing related to mrtrix2 (you can check your PATH by typing echo $PATH). This means I’ll always be using my main MRtrix3 install by default. If I need to invoke a command from MRtrix 0.2, I can do so by invoking the command using its full path, like this:

$ ~/mrtrix2/bin/streamtrack SD_PROB fod.mif ...


$ /home/donald/mrtrix2/bin/streamtrack SD_PROB fod.mif ...

This basically sidesteps the normal PATH lookup.

If you want to run a session where all the commands are guaranteed to be the older version, you can always amend the PATH directly on the command-line:

$ export PATH=~/mrtrix2/bin:$PATH

at which point all subsequent command lookups within that shell session will look in the ~/mrtrix2/bin folder first, so use that version preferentially. You can of course also include this at the head of your scripts, etc. as required.

Finally, if you need to do this often, you can also include a line like this in your ~/.bashrc file (or whichever is the correct startup script on your system):

alias mrtrix2="export PATH=~/mrtrix2/bin:$PATH"

You’ll then be able to simply type mrtrix2 at the terminal, and it’ll amend your PATH to use the MRtrix 0.2 commands preferentially.


Thanks for the detailed reply. You’re as helpful as ever! I will try it out and see how it goes. Thanks again.