On OSX. How might I test whether fortran is installed on my machine?
$ fortran
-bash: fortran: command not found
Super User is a question and answer site for computer enthusiasts and power users. It only takes a minute to sign up.
Sign up to join this communityOn OSX. How might I test whether fortran is installed on my machine?
$ fortran
-bash: fortran: command not found
A lot depends on the operating system that you're running. The error message that you included in your indicates that you're running the "bash" shell, which is most commonly seen on Linux systems. The most commonly used Fortran compiler on such systems is the GNU fortran compiler, which you would invoke by
$ gfortran
Try issuing that command to see what happens. If you get
gfortran: fatal error: no input files
compilation terminated.
then you've got gfortran installed on the system.
There are of course many other fortran compilers available for Linux systems, including compilers from Intel and the Portland Group. Another useful test would be to issue the command
$ man -k fortran
which should give you a list of man page entries related to Fortran. It's likely that this will help you identify any other Fortran compilers that might be on your system.
PATH
, then this method will fail. As a backup, you could check to see if gfortran is installed by running find / -name gfortran
(note, to search all directories, you will need to run this command as sudo
or root). In order to exhaustively check your computer for fortran compilers, you would also need to check for the names of other Fortran compiler executables (ifort
for the Intel Fortran Compiler, etc.).
Jul 19, 2013 at 6:25
The bash command apropos
followed by a keyword will search for commands that match the string you pass to it, provided that they're installed in your $PATH
. Running apropos fort
would find either gfortran
or ifort
if you have them, but Macs don't have any fortran compiler by default.
This will list all the compilers installed: dpkg --list | grep compiler
Check if Fortan appears in the list or not.