Take the 2-minute tour ×
Super User is a question and answer site for computer enthusiasts and power users. It's 100% free, no registration required.

On OSX. How might I test whether fortran is installed on my machine?

$ fortran
-bash: fortran: command not found
share|improve this question

migrated from scicomp.stackexchange.com Jul 19 '13 at 13:56

This question came from our site for scientists using computers to solve scientific problems.

3 Answers 3

up vote 0 down vote accepted

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.

share|improve this answer
    
If something screwy has happened, and a Fortran compiler is on the machine but the directory containing the compiler isn't in the user's 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.). –  Geoff Oxberry Jul 19 '13 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.

share|improve this answer

This will list all the compilers installed: dpkg --list | grep compiler Check if Fortan appears in the list or not.

share|improve this answer
    
-bash: dpkg: command not found –  AJcodez Jul 19 '13 at 4:28
1  
dpkg is not a command that is available on OS X. –  Geoff Oxberry Jul 19 '13 at 6:10
    
Elegant solutions like these dont work on OS X :) Btw dpkg only knows about compilers installed from the repo/debs and anything installed by a sysadmin/user locally wont show up. –  stali Jul 19 '13 at 11:56

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.