Could you run the following commands in a terminal (not MATLAB command window):
/Applications/Dynare/5.2/matlab/modules/dseries/src/../externals/x13/macOS/64/x13as
ls /usr/local/opt/gcc/lib/gcc
ls /opt/homebrew/opt/gcc/lib/gcc
and post the result?
On my machine I get either the following for the Intel version of Dynare:
dyld[7402]: Library not loaded: '/usr/local/opt/gcc/lib/gcc/11/libgfortran.5.dylib'
Referenced from: '/Applications/Dynare/5.2-x86_64/matlab/modules/dseries/externals/x13/macOS/64/x13as'
Reason: tried: '/usr/local/opt/gcc/lib/gcc/11/libgfortran.5.dylib' (no such file), '/usr/local/lib/libgfortran.5.dylib' (no such file), '/usr/lib/libgfortran.5.dylib' (no such file)
or the following error for Dynare’s ARM version:
dyld[7233]: Library not loaded: '/opt/homebrew/opt/gcc/lib/gcc/11/libgfortran.5.dylib'
Referenced from: '/Applications/Dynare/5.2-arm64/matlab/modules/dseries/externals/x13/macOS/64/x13as'
Reason: tried: '/opt/homebrew/opt/gcc/lib/gcc/11/libgfortran.5.dylib' (no such file), '/usr/local/lib/libgfortran.5.dylib' (no such file), '/usr/lib/libgfortran.5.dylib' (no such file)
So for me this was related to different versions of gcc and the required libraries. I had version 12 installed while we use version 11 to compile x13as. So a quick fix is to symlink the folder with the libraries. That is,
- If you’ve installed the Intel version (i.e. you get missing libraries with the above command in the /usr/local folder), then run the following:
ln -s /usr/local/opt/gcc/lib/gcc/12 /usr/local/opt/gcc/lib/gcc/11
- If you’ve installed the ARM version (i.e. you get missing libraries with the above command in the /opt/homebrew folder), then run the following:
ln -s /opt/homebrew/opt/gcc/lib/gcc/12 /opt/homebrew/opt/gcc/lib/gcc/11
But maybe @sebastien has a more elegant way of fixing this?