ROOT 5 and ROOT 6 on the same system(Linux), where/when are the libraries being loaded?![not from .bashrc]

I have successfully installed and compiled root 5 and root 6 on my laptop.

I have extensively used root5 and root6 both in different applications when only one is installed.

Here’s a challenge, when I have set up my aliases just fine so that I can run
"root -l root6code.cpp" macro works fine
"root5 -l root5code.cpp" macro works fine
compiling a code that imports from root breaks everything/

In my .bashrc, I am trying to set up so that I have two static variables in the beginning:

export native_path=$PATH
export native_ld_library_path=$LD_LIBRARY_PATH

then I can do:

alias root5load="export PATH=$ROOTSYS5/bin:$native_path ; export LD_LIBRARY_PATH=$ROOTSYS5/lib:$native_ld_library_path;"
alias root5="source ~/ROOT5/bin/; ~/ROOT5/bin/root"

to run root 5.

Here’s a challenge.

even after I commented everything out in .bashrc

if I load the terminal and type in

echo $PATH

both root 5 and root 6 are already loaded.

Where are these being loaded if not in .bashrc?!

Thank you for your time
-SJLPreformatted text


perhaps you might be interested in looking into already existing comprehensive solutions such as


1 Like

Try: alias root5load="source ${HOME}/ROOT5/bin/" alias root5="root5load; root" alias root6load="source ${HOME}/ROOT6/bin/" alias root6="root6load; root"


for the time being, I have a standing fix to load in my .bashrc

I will reply with my standing fix.

However, the question still stands, where are the root environments being loaded from?! It’s not in .bashrc!

At the current state, I am using .bashrc to remove all the repeated ROOT environments, and setting them to “native_” environments.

export native_path=$(echo $PATH | sed 's/\/home\/SJL\/ROOT\/\/bin[:]//'|sed 's/\/home\/SJL\/ROOT5\/\/bin[:]//'|sed 's/\/home\/SJL\/ROOT\/\/bin[:]//')
export native_ld_library_path=$(echo $LD_LIBRARY_PATH | sed 's/[:]\/home\/SJL\/ROOT\/\/lib//'|sed 's/[:]\/home\/SJL\/ROOT5\/\/lib//'|sed 's/\/home\/SJL\/ROOT\/\/lib[:]\/lib[:]//')

then I fresh re-set to native path

export PATH=$native_path
export LD_LIBRARY_PATH=$native_ld_library_path

then I start setting up root environments, by default to root 6.

export PATH=$ROOTSYS/bin:$PATH
export LD_LIBRARY_PATH=$ROOTSYS/lib:$native_ld_library_path

then I set up in case, I want to reset to root5/root6 interchangeably.

#Setting up PyROOT for root6
alias nativeload="export PATH=$native_path; export LD_LIBRARY_PATH=$native_ld_library_path"
alias root5load="export PATH=$ROOTSYS5/bin:$native_path ; export LD_LIBRARY_PATH=$ROOTSYS5/lib:$native_ld_library_path;"
alias root6load="export PATH=$ROOTSYS/bin:$native_path ; export LD_LIBRARY_PATH=$ROOTSYS/lib:$native_ld_library_path;"

This way, I can unload both, or load one at a time, with default ROOT6 being loaded.

However, I still am very curious, and wish to find out where the environments are set, if not in the $HOME directory.

I second this. This is what I use for my everyday work flow and it makes it very clear what is going on.

Yikes, this would sure clutter up your environment quickly.

There are a number of places where you environment could be loaded from. See this page for some more information. Also, it may be that your environment was set with ROOT in the paths, and then you removed those from .bashrc, but this would not be instantly reflected in your current environment.

1 Like

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.