Fatal error installing ROOT on Sonoma 14.5. Missing libraries

I am trying to install root by the precompiled binary distribution.
After overcoming some errors due to Mac blocking libraries as unsafe, I got the following error:
Your help is appreciated.
Thank you

Fatal in <TROOT::InitInterpreter>: cannot load library dlopen(/Users/luca/local/root/root_v6.32.00/lib/libCling.so, 0x0005): Library not loaded: /opt/local/lib/libzstd.1.dylib
  Referenced from: <A409AEB9-F21B-3301-A8D8-58BBCE0922C6> /Users/luca/local/root/root_v6.32.00/lib/libCling.so
  Reason: tried: '/Users/luca/local/root/root_v6.32.00/lib/libzstd.1.dylib' (no such file), '/opt/local/lib/libzstd.1.dylib' (no such file), '/System/Volumes/Preboot/Cryptexes/OS/opt/local/lib/libzstd.1.dylib' (no such file), '/opt/local/lib/libzstd.1.dylib' (no such file)

ROOT Version: v6.32.00
Platform: Sonoma 14.5
Compiler: Apple clang version 15.0.0 (clang-1500.3.9.4)

Hi @mole.luca,
thanks for reaching out!
It looks like you’re missing zstd. Did you try to install it with brew install zstd?


Hi Monica. Thank you for the suggestion.
Now I did install it, but still get the error. Maybe some reference is missing? I would appreciate your help.
Thank you

Maybe you should install zstd-dev. After installation, can you check if you can find libzstd.1.dylib in any of the expected paths?

Hi. I had a more careful look. It seems that indeed it is simply a problem of paths.
libzstd.1.dylib is in /opt/homebrew/lib, while root is looking for it in opt/local/lib.
What is the best way to get this matching? Do you still think that I should install zest-dev?
Thank you

Adding /opt/homebrew/lib to your path should be sufficient in this case!

Thank you for your answer. In order to add the path I am trying to follow this page: Setting the environment variables. I am confused about the way it works.
What I tried is to add those lines into my .zsrc file:

export LD_LIBRARY_PATH=$LD_LIBRARY_PATH:/opt/homebrew/lib
source ~/local/root/root_v6.32.00/bin/thisroot.sh

but it appears not to be the right thing to do. How should it be done instead?
Thank you

You should add there lines to your ~/.zshrc file and then source it source ~/.zshrc.

Also, you could run brew shellenv

I gave up on installing by binary source and did it by home-brew. It worked perfectly.
Thank you