osx - How to get started with Fortran on a Mac? -


just finished installing compiler gfortran 6.1. el capitan. next, want know how run file. so, have few questions:

1) extension should use save file? .f90 or else? 2) there free fortran editors mac recommend (and don't take time getting used to)? 3) once save file, how compile it? is gfortran followed file name (with path) in terminal? also, how path on mac?

a step step guide great help. first time mac user. :)

  1. .f90 free formatted sources commonly used
  2. any texteditor comfortable , used to, vim example
  3. gfortran /your/source/file absolute path. if in directory of source file not need specify complete path.

step step "hello world":

  • create text file fortran program
  • just give command line example without need editor (this not typically do):

    • open terminal, enter

      cat >hello.f90 <<eof program hello   implicit none   write(*,*) 'hello world' end program hello eof 
  • compile program in terminal with: gfortran hello.f90

  • execute in terminal ./a.out
  • if want name use -o option:

    gfortran -o hello hello.f90 ./hello