Fortran for Apple Silicon

Apple will develop a Fortran compiler for the new Apple Silicon platform?
Up vote post of dareus Down vote post of dareus
Post marked as solved 363 views

12 Replies

Your best bet is probably flang which is part of the LLVM project. Not really production ready yet, but should be usable when the arm64 Macs are released.
Thanks to the work of fxcoudert and Iain Sandoe there is now an experimental release of gfortran. It worked well in my limited testing.  https://github.com/fxcoudert/gfortran-for-macOS/releases
Apple hasn’t develop any publicly-available Fortran compiler to date, and there is no indication that would change.

Furthermore lack of gcc (the GNU Compiler Collection) support for Apple Silicon seems to be holding back Fortran as well, since many open source Fortran project seems to depend on that.

In any case, you could run gcc (and thus Fortran) under Rosetta 2. Many CPU-oriented Benchmarks has shown that the M1 already runs Intel apps faster than most portable Macs that came before it. Search the web for “How to Run Legacy Command Line Apps on Apple Silicon“ to set up a Terminal profile that runs Intel apps by default so that you can continue using Fortran in “Intel mode” until native support finally arrive.

I have not heard anything from Apple but the NAG Fortran Compiler is available. Search for "nag fortran apple".
Not by Apple, but a Fortran compiler tuned for Apple Silicon is out now from NAG.


Any update on this? All my native C applications compile for Apple Silicon. However, many scientists leverage my tools using R and their pipelines depend on Fortran for specific functions. Good support for R and Fortran is really important for many scientists.

I have 100% confidence that Apple's level of support for Fortan will not change with the switch to Apple Silicon.


Any update on this? All my native C applications compile for Apple Silicon. However, many scientists leverage my tools using R and their pipelines depend on Fortran for specific functions. Good support for R and Fortran is really important for many scientists.
Apple makes Swift and had no control over gfortran. You'll have to re-direct your requests to GNU and ask them to port gfortran to Apple Silicon.
Keep an eye here for developments https://github.com/Homebrew/brew/issues/7857
You'll want to follow the gcc support, which is just starting with gmp getting support for Apple Silicon. I can't imagine Apple Silicon not having a compatible fortran compiler, considering you can use gfortran with other AArch64 targets.
I use iMac and MacBook Pro for scientific computing with Intel Fortran, sometimes gfortran. If it will not possible to use a fortran compiler in the new Macs I will have to abandon Apple.
I have used flang successfully on Apple Silicon, but flang/f18 itself doesn't come with a Fortran runtime (it uses pgf90 by default) and as of now, there is no compatible Fortran runtime to generate executables. Anyone able to troubleshoot this yet?
There are currently no options:
  • no commercial compiler

  • LLVM's Fortran front-end is not functional: cannot compile very simple code, array assignments, and basic libraries like LAPACK

  • GCC does not currently target arm-darwin

This impacts a lot of scientific code, and in particular Python libraries that rely on Fortran, such as Scipy, scikit-learn, and many others.