Get Started on macOS*
Before You Begin
Before you can use this tool, you must first set the environment variables by sourcing the environment script using the initialization utility to initialize all the tools in one step.
From a terminal session, run:
source <install_dir>/setvars.shBy default, the path for <install_dir> is /opt/intel/oneapi
Use the Command Line
Invoke the compiler using the following syntax:
ifort [option] file1 [file2...] [/link link_options]
For example: ifort helloworld.f90
Build a Program
Follow the steps below to test your compiler installation and build a program.
- Use a text editor to create a file called hello.f90 with the following contents:
print *, "Hello, world!" end
- From a command prompt, issue the following command using a BASH-style shell:
. /<install_dir>/setvars.sh
This command adds the compiler directors to PATH and updates LD_LIBRARY_PATH to make it easier to run a Fortran program.
The command to invoke the setup script must be done in any command window where you want to use the Intel® Fortran Compiler. Alternatively, the command can be added to a .bashrc or other shell startup file.
- From the command prompt, issue the following command:
ifort –o hello hello.f90
- Now you have an executable called hello, which can be run and will give immediate feedback.
hello
Which outputs:
Hello, world!
Next Steps
- Explore the latest oneAPI Fortran Code Samples.