I am installing an R package that relies on gfortran.
As below, I get such errors.
ld: warning: search path '/opt/gfortran/lib/gcc/aarch64-apple-darwin20.0/12.2.0' not found
ld: warning: search path '/opt/gfortran/lib' not found
ld: library 'gfortran' not found
clang: error: linker command failed with exit code 1 (use -v to see invocation)
However, I have gcc and gfortran installed.
$ which gcc
/usr/bin/gcc
$ which gfortran
/opt/homebrew/bin/gfortran
I also have Xcode downloaded from app store and run xcode-select –-install already
.
As @Till pointed out, I'd install fortran from the macosx r-project space. It seems like a path variable is not set properly on your system. See also this question.
If you really want to use the homebrew version of fortran for the use in R make sure that RStudio uses the right path variable. You could follow this guide. However installing gfortran-12.2-universal.pkg from the link above is a lot less of a pain.