Can I have multiple versions of ROS or ROS2 installed on a single machine or PC?


1 Answer 1


Yes. See discussion here: https://answers.ros.org/question/187548/can-i-install-multiple-ros-version-on-the-same-machine/

Each ROS distro (both 1 & 2) installs its programs into /opt/ros/{distro}, so you can have them installed side-by-side with no conflict.

However you should only use one distro at a time. In order to use a distro, you source its setup script in your shell, e.g.:

$ source /opt/ros/humble/setup.bash
...the remainder of this session will be in the humble environment

If you plan to have multiple ROS versions installed and use them regularly, I would not recommend doing this inside your .bashrc or equivalent login script, because you need to avoid having multiple distros sourced in the same shell. Whenever you want to start using a distro, just source its setup script manually.

  • $\begingroup$ Yeah, Thanks it helped. but I have a doubt. Generally the source scripts are added to the .bashrc file or what ever shell you may use for convenience . So here in case of multiple versions of ROS being installed we cannot add both of the sourcing script to the bash file right? $\endgroup$
    – Jishnu
    Dec 15, 2022 at 18:23
  • 1
    $\begingroup$ Correct, you cannot source both distros in the same shell. That's why I recommended that you don't put it in .bashrc for convenience. You can make a simple function for convenience, such as chros() { source /opt/ros/$1/setup.bash } => chros humble $\endgroup$
    – jtbandes
    Dec 15, 2022 at 19:39

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.