Reputation: 31
I am trying to install Fortran on my MacBook MacOS Monterey (version 12.2.1) M1 chip laptop. I downloaded and installed the gfortran from this website (gfortran 12-Dec 18, 2021): https://github.com/fxcoudert/gfortran-for-macOS/releases with no issues.
I then followed the instructions on this link: https://thecoatlessprofessor.com/programming/cpp/r-compiler-tools-for-rcpp-on-macos/ and when following the steps to do a 'quick check' with C++, I receive these errors:
ld: warning: directory not found for option '-L/opt/R/arm64/gfortran/lib/gcc/aarch64-apple-darwin20.2.0/11.0.0'
ld: warning: directory not found for option '-L/opt/R/arm64/gfortran/lib'
ld: library not found for -lgfortran
clang: error: linker command failed with exit code 1 (use -v to see invocation)
make: *** [sourceCpp_3.so] Error 1
I attempted to solve the issue by inputted this command in terminal:
ln -s /usr/local/gfortran /opt/R/arm64
But I received a "Permission denied" output.
There may be issues with installing gfortran on Monterey M1 chip, but I think the main problem is where my gfortran is located on my laptop. I am not sure. Does anyone have a solution as to how to relocate gfortran on my laptop through Terminal?
Much appreciated.
Upvotes: 3
Views: 17469
Reputation: 23
Have you tried to install and update XCode Command Line Tools? In principle, it comes with gcc and gfortran. Once installed, you do not need to use directly XCode to run gfortran on a terminal. XCode is available from the app store.
You can also install gcc (which contain gfortran) via brew brew install gcc
.
Upvotes: 1