Root-config: command not found

Hello everyone, I’m trying to setup and run ROOT on my MacOS v10.13 but facing some error messages when I run source bin/thisroot.sh and root commands. I have followed instructions as per the readme file provided here: https://github.com/root-project/root

Harshits-MacBook-Air:build harshitprasad$ source bin/thisroot.sh
-bash: root-config: command not found
Harshits-MacBook-Air:build harshitprasad$ root
-bash: root: command not found

It would be great if anyone can help me out to solve this error. :slight_smile:

root-config should be in the same bin directory as thisroot.sh is it the case ?

Hi @couet :slight_smile: I have followed instructions as per the readme file provided here: https://github.com/root-project/root

I’m new to ROOT. I have successfully completed ROOT build on my machine. These are the last steps i.e to setup and run ROOT.

can you confirm 'root-config` is in the same directory ?

with bash you may need to do:

. bin/thisroot.sh

instead of `source’

@couet I have checked root-config is in the same directory. Executing only bin/thisroot.sh says permission denied.

do not forget the dot “.” … exactly like I typed it …

I’m getting this error now after running . bin/thisroot.sh command:

Harshits-MacBook-Air:build harshitprasad$ . bin/thisroot.sh
sed: 1: "s;:/Users/harshitprasad ...": unterminated substitute pattern
-bash: sed: No such file or directory
-bash: sed: No such file or directory
-bash: sed: No such file or directory
-bash: sed: No such file or directory
-bash: sed: No such file or directory
-bash: sed: No such file or directory
-bash: sed: No such file or directory
-bash: sed: No such file or directory
-bash: root-config: command not found
-bash: grep: command not found
-bash: grep: command not found

oh … your system seems quite sick if grep and sed are not found…
You need to have Xcode and the command line tools installed.
do:

xcode-select --install
1 Like

Thank you for quick reply :slight_smile: After running xcode-select --install it seems like I have already command line tools installed. I have also checked the version of grep:

Harshits-MacBook-Air:~ harshitprasad$ grep --version
grep (BSD grep) 2.5.1-FreeBSD

Really weird. I am also using bash on my Mac and . bin/thisroot.sh works fine.

@couet yes you’re right. It’s the issue with the xcode. I will look into it. Rest looks good. Thank you for helping me out. I really appreciate it. :slight_smile:

Hi @couet. I have again checked my installation of xcode. It has been installed properly. I’m sharing the terminal errors which I get when I run . bin/thisroot.sh more than one time:

Harshits-MacBook-Air:build harshitprasad$ . bin/thisroot.sh
-bash: root-config: command not found
Harshits-MacBook-Air:build harshitprasad$ . bin/thisroot.sh
sed: 1: "s;:/Users/harshitprasad ...": unterminated substitute pattern
-bash: sed: No such file or directory
-bash: sed: No such file or directory
-bash: sed: No such file or directory
-bash: sed: No such file or directory
-bash: sed: No such file or directory
-bash: sed: No such file or directory
-bash: sed: No such file or directory
-bash: sed: No such file or directory
-bash: root-config: command not found
-bash: grep: command not found
-bash: grep: command not found
Harshits-MacBook-Air:build harshitprasad$ . bin/thisroot.sh
-bash: dirname: command not found
-bash: cat: command not found
-bash: sed: command not found
-bash: sed: No such file or directory
-bash: sed: No such file or directory
-bash: sed: No such file or directory
-bash: sed: No such file or directory
-bash: sed: No such file or directory
-bash: sed: No such file or directory
-bash: sed: No such file or directory
-bash: sed: No such file or directory
-bash: root-config: command not found
-bash: grep: command not found
-bash: grep: command not found

In the starting, what I did cd build then cmake ../root was giving me error. So, I run the command cmake .. after that run make -j8 and the build was successful. I’m facing above issue only. Am I doing something wrong here?

Here is the error which I was getting while running cmake ../root

Harshits-MacBook-Air:root harshitprasad$ cmake ../root
-- The C compiler identification is AppleClang 9.0.0.9000039
-- The CXX compiler identification is AppleClang 9.0.0.9000039
-- Check for working C compiler: /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/cc
-- Check for working C compiler: /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/cc -- works
-- Detecting C compiler ABI info
-- Detecting C compiler ABI info - done
-- Detecting C compile features
-- Detecting C compile features - done
-- Check for working CXX compiler: /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/c++
-- Check for working CXX compiler: /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/c++ -- works
-- Detecting CXX compiler ABI info
-- Detecting CXX compiler ABI info - done
-- Detecting CXX compile features
-- Detecting CXX compile features - done
-- Performing Test HAS_CXX11
-- Performing Test HAS_CXX11 - Success
-- Looking for pthread.h
-- Looking for pthread.h - found
-- Looking for pthread_create
-- Looking for pthread_create - found
-- Found Threads: TRUE  
-- Found a Mac OS X System 10.13
-- Found a 64bit system
-- Found LLVM compiler collection
-- Performing Test GLIBCXX_USE_CXX11_ABI
-- Performing Test GLIBCXX_USE_CXX11_ABI - Failed
-- ROOT Platform: macosx
-- ROOT Architecture: macosx64
-- Build Type: RelWithDebInfo
-- Compiler Flags:  -Wc++11-narrowing -Wsign-compare -Wsometimes-uninitialized -Wconditional-uninitialized -Wheader-guard -Warray-bounds -Wcomment -Wtautological-compare -Wstrncat-size -Wloop-analysis -Wbool-conversion -m64 -pipe -W -Wshadow -Wall -Woverloaded-virtual -fsigned-char -fno-common -Qunused-arguments -pthread -std=c++11 -stdlib=libc++ -O2 -g -DNDEBUG
CMake Error at cmake/modules/RootNewMacros.cmake:1041 (message):
  ROOT should be built as an out of source build, to keep the source
  directory clean.  Please create a extra build directory and run the command
  'cmake <path_to_source_dir>' in this newly created directory.  You have
  also to delete the directory CMakeFiles and the file CMakeCache.txt in the
  source directory.  Otherwise cmake will complain even if you run it from an
  out-of-source directory.
Call Stack (most recent call first):
  CMakeLists.txt:107 (ROOT_CHECK_OUT_OF_SOURCE_BUILD)


-- Configuring incomplete, errors occurred!
See also "/Users/harshitprasad/Desktop/GSoC/root/CMakeFiles/CMakeOutput.log".
See also "/Users/harshitprasad/Desktop/GSoC/root/CMakeFiles/CMakeError.log".

I am afraid i do not understand what is wrong with your file bin/thisroot.sh … can you try bin/thisroot.csh ?

source bin/thisroot.csh gives me this error:

Harshits-MacBook-Air:build harshitprasad$ source bin/thisroot.csh
-bash: bin/thisroot.csh: line 17: syntax error near unexpected token `('
-bash: bin/thisroot.csh: line 17: `set ARGS=($_)'

I have fixed the above syntax error but again I’m getting another error:

Harshits-MacBook-Air:build harshitprasad$ source bin/thisroot.csh
-bash: bin/thisroot.csh: line 46: syntax error near unexpected token `else'
-bash: bin/thisroot.csh: line 46: `   else'

Do I need to setup PATH environment variables to overcome sed and grep errors?

Harshits-MacBook-Air:~ harshitprasad$ which -a grep
/usr/bin/grep
Harshits-MacBook-Air:~ harshitprasad$ which sed
/usr/local/bin/sed

Indeed the script bin/thisroot.sh is the right one to use. I do not understand when you source it the grep and sed command is not found whereas they are when you type directly the command at the prompt. May be my colleague @amadio will have an idea ?

Sure @couet it will be a great help. :slight_smile: I have also asked on Stackoverflow the same issue. Here is the link: https://stackoverflow.com/questions/49140419/sed-and-grep-no-such-file-or-directory

if I remember well, Mac OS “sed” is NOT compatible with GNU “sed” (but I think you can install GNU “sed” on Mac OS).

Dear @harshit.prasad, I am not sure that you actually finished building ROOT. Can you please describe the procedure you used to build it in a bit more detail?

Please add the configuration option -DCMAKE_INSTALL_PREFIX=/usr/local/root and then install it with make install instead of using ROOT from the build directory. After you install it into /usr/local/root, all you need to do is to add /usr/local/root/bin to your path and /usr/local/root/lib to your LD_LIBRARY_PATH and everything will work without needing to source thisroot.sh. If you build ROOT with Python support enabled, then you may also have to add /usr/local/root/lib to PYTHONPATH. You can do that by adding this to your bashrc:

export ROOTSYS=/usr/local/root
export PATH=$PATH:$ROOTSYS/bin
export LD_LIBRARY_PATH=$LD_LIBRARY_PATH:$ROOTSYS/lib
export PYTHONPATH=$PYTHONPATH:$ROOTSYS/lib

Feel free to exchange /usr/local/root by other installation path of your choice.

  1. I have first forked this repository: https://github.com/tmvadnn/root. Basically, I want to contribute in DNN architecture of TMVA.
  2. git checkout tmva-dnn-dev-test to work on tmva-dnn-dev-test branch with latest commits.
  3. Followed the build instructions as per given in Github readme file:
mkdir build
cd build
cmake ..
sudo make // not used make -j8
. bin/thisroot.sh

It would be great if you can provide steps and I’m working with cmake for first time. Just got little bit confused here. Here is the output:

Harshits-MacBook-Air:~ harshitprasad$ cmake -DCMAKE_INSTALL_PREFIX=/usr/local/root
CMake Error: The source directory "/Users/harshitprasad" does not appear to contain CMakeLists.txt.

I have added the paths in .bashrc file as you’ve suggested. :slight_smile:

UPDATE: @amadio I have fixed the above error, now I’m getting this error when I run make install

Harshits-MacBook-Air:~ harshitprasad$ cmake -DCMAKE_INSTALL_PREFIX=/usr/local/root
-- The C compiler identification is AppleClang 9.0.0.9000039
-- The CXX compiler identification is AppleClang 9.0.0.9000039
-- Check for working C compiler: /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/cc
-- Check for working C compiler: /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/cc -- works
-- Detecting C compiler ABI info
-- Detecting C compiler ABI info - done
-- Detecting C compile features
-- Detecting C compile features - done
-- Check for working CXX compiler: /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/c++
-- Check for working CXX compiler: /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/c++ -- works
-- Detecting CXX compiler ABI info
-- Detecting CXX compiler ABI info - done
-- Detecting CXX compile features
-- Detecting CXX compile features - done
-- Configuring done
-- Generating done
-- Build files have been written to: /Users/harshitprasad
Harshits-MacBook-Air:~ harshitprasad$ make install
make: *** No rule to make target `install'.  Stop.

Thank you very much for helping me out @amadio and @couet :slight_smile:

I have successfully finished building ROOT.