M芯片的macOS系统安装gfortran

2022-07-22
#Unix #Fortran

1. 说明

在跑Fotran程序时,使用Intel oneapi的Fortran(即,ifort)是需要Intel芯片,官网见:Intel® Fortran Compiler

  • Intel Core processors
  • Intel Xeon processor family
  • Intel Xeon Scalable processors

M1芯片和M2芯片的macOS系统,跑Fortran程序时,需要gfortran

2. 安装goftran

Releases · fxcoudert/gfortran-for-macOS,下载gfortran-ARM-12.1-Monterey.dmg for Apple Silicon computers并安装即可。

测试gfortran:

~ gfortran --version
GNU Fortran (GCC) 12.1.0
Copyright (C) 2022 Free Software Foundation, Inc.
This is free software; see the source for copying conditions.  There is NO
warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
~ where gfortran
/usr/local/bin/gfortran

3. 参考