#プログラミング勉強中 配列phi使ってなかったわ😅 あと、3次元表示が合っているのかどうかが、わからない。 #programming #fortran #fortran90 / 95 #gfortran + #gnuplot #vscode #macos #bigsur #macmini #macminim1 https://www.instagram.com/p/CQn6Iz0Dn4l/?utm_medium=tumblr
seen from Russia
seen from United States
seen from United States
seen from Chile

seen from United States
seen from France
seen from United States

seen from United States

seen from United States
seen from United States
seen from United States

seen from United States

seen from United Kingdom
seen from United States

seen from Malaysia
seen from Russia
seen from Switzerland

seen from Switzerland
seen from Switzerland
seen from Singapore
#プログラミング勉強中 配列phi使ってなかったわ😅 あと、3次元表示が合っているのかどうかが、わからない。 #programming #fortran #fortran90 / 95 #gfortran + #gnuplot #vscode #macos #bigsur #macmini #macminim1 https://www.instagram.com/p/CQn6Iz0Dn4l/?utm_medium=tumblr
#プログラミング勉強中 ひさびさの #fortran なのでリハビリが必要。 モダン化したFortranは全然いける!結構好き。😻 #programming #gfortran #f95 + #gnuplot #vscode #macos #bigsur #macmini #macminim1 https://www.instagram.com/p/CPvuTZ4j0x7/?utm_medium=tumblr
gfortran for Mac OS X
DISCLAIMER: I provide this information here to aid my memory and in the hope that others will find it a useful resource based on my experiences of installing a gfortran compiler on Macs. I am not a computer scientist or Fortran guru and, as such, am unlikely to be able to help you with Fortran code, compilation or runtime problems.
There are several options available for installing gfortran for Mac OS X, other than installing from source code.
GCC Wiki
I currently choose to use the relevant gfortran installer (.dmg) packages provided through the GCC Wiki (opens in new window). Note that the files are installed in /usr/local system directories which require the administrator password.
HPC
There are also various tar-files of gfortran distributions provided at the High Performance Computing web page. There are up-to-date distributions for some systems (only Mac OS X 10.7 (Lion), 10.8 (Mountain Lion) and 10.9 (Mavericks) as of the last update of this page).
I recommend not to choose a package containing a version beyond the latest stable version according to the main GCC web site, i.e. only use version 4.8 or prior, as of the last update of this web page. Furthemore, for simplicity, I would recommend only to install the relevant "gfortran only" distributions.
The files are gzip'd tar-files which should be unpacked, for instance by using the Terminal application, as follows:
sudo tar xvfz [tar-file] -C /
Note that the files are installed in /usr/local system directories which require the administrator password.
The R Project
Previously, I had preferred to use the gfortran packages distributed in association with the R Project. These can be found in the "Apple Xcode gcc-42 add-ons" section of their Tools web page (opens in new window) or via the direct links below. These gfortran packages and updates are specifically built to match Apple's own gcc builds. This does mean that the version is back at GCC 4.2, which is undoubtedly where it will stay since GCC changed their licensing and Apple has stopped updating their GCC distribution with Xcode. Nonetheless, my experience shows that this distribution is one that always works.
There are several packages relevant to particular Mac OS X and Xcode installations. Run gcc -v to find out which Apple gcc build is currently installed as part of the Xcode tools.
Mac OS X 10.7 (Lion) and 10.8 (Mountain Lion):
with Xcode 4.2 and 4.3 (build 5666.3)
with Xcode 4.0 and 4.1 (build 5666.3)
One may need to apply a link after installing one of these packages so "gfortran" may be used as a command, e.g.
sudo ln -s /usr/bin/gfortran-4.2 /usr/bin/gfortran
Otherwise, simply use the explicit command "gfortran-4.2".
Mac OS X 10.6 (Snow Leopard):
with Xcode 3.2.3 to 3.2.5 (build 5664), and 3.2.6, 4.0 and 4.1 (build 5666.3)
with Xcode 3.2.2 (build 5659)
Mac OS X 10.5 (Leopard):
with Xcode 3.1.4 (build 5577)
with Xcode 3.1 and 3.1.1 (build 5564)
The files for builds 5564 and 5566 are gzip'd tar-files which should be unpacked, for instance by using the Terminal application, as follows:
sudo tar xvfz [tar-file] -C /
Note that the files are installed in /usr system directories which require the administrator password.
Packages for older OS X and Xcode versions are also available on the page linked to above.
Compatibility and uninstalling
It should be noted that each of these distributions has different associated libraries and other installed files which may conflict with or be wholly or partially overwritten by one another. It is therefore advisable to ensure that you have only one distribution installed at any one time.
Uninstalling the GCC Wiki distribution is straightforward and instructions are provided on the detailed instructions web page. Simply run the command:
sudo rm -r /usr/local/gfortran /usr/local/bin/gfortran
Uninstallation of the R Project or HPC distribution is slightly more difficult. HPC distributes gfortran as a tar-file. Therefore each file contained in the tar-file should be removed. The easiest way to do this is probably to run the command:
For sh/bash: for file in $(tar tfz [tar-file]); do sudo rm -f /$file; done
For csh/tcsh: foreach file ( `tar tfz [tar-file]` ) sudo rm -f /$file end
where [tar-file] is the package, for example gfortran-4.7-bin.tar.gz, gfortran-lion.tar.gz, gfortran-snwleo-intel-bin.tar.gz, etc. This will remove all files but not directories, which may contain other files that are not to be removed. To remove empty directories only, then run the command:
For sh/bash: for file in $(tar tfz [tar-file]); do sudo rmdir -p /$file; done
For csh/tcsh: foreach file ( `tar tfz [tar-file]` ) sudo rmdir -p /$file end
The R Project distribution is a .pkg file and this adds another level of complication. To list the files that were installed from this package, one needs to locate the "receipt", which is a .bom file. On my system (Mac OS X 10.8, Mountain Lion) the file is located at /private/var/db/receipts/org.r-project.gcc-42.darwin11.pkg.bom (was /private/var/db/receipts/org.r-project.gnuFortran42.lion.usr.pkg.bom for Mac OS X 10.7, Lion; or /private/var/db/receipts/org.r-project.mac.tools.gfortran.bom for Mac OS X 10.6, Snow Leopard). To find the file, run a command such as:
sudo find / -iname '*fortran*.bom'
Once the appropriate file has been located, a list of files that have been installed can be found by running the command:
lsbom -pF [bom-file]
Therefore, similarly to removing the HPC distribution, the files can be removed by running commands such as:
For sh/bash: for file in $(lsbom -pF [bom-file]); do sudo rm -f $file; done for file in $(lsbom -pF [bom-file]); do sudo rmdir -p $file; done
For csh/tcsh: foreach file ( `lsbom -pF [bom-file]` ) sudo rm -f $file end foreach file ( `lsbom -pF [bom-file]` ) sudo rmdir -p $file end
Note that these commands should be run from the root directory (cd / first).
(via an MIT postdoc, also note for myself)