Get Started

  • 2021.4
  • 09/27/2021
  • Public Content

Get Started on macOS*

Before You Begin

macOS is not supported for the
ifx
compiler.
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>/bin/setvars.sh
where
<install_dir>
is the directory structure containing the compiler
/bin
directory.
By default, the path for
<install_dir>
is
opt/intel/compilers_and_libraries_2021.<update number>.<package number>/mac

Use the Command Line

Use the command below to invoke the compiler from the command line.
  • ifort helloworld.f90

Build a Program

Follow the steps below to test your compiler installation and build a program.
  1. Use a text editor to create a file called "hello.f90" with the following contents:
    print *, “hello!” end
  2. From a command window, issue the following command to define the compiler using the C-SHELL.
    /usrs/users/me$ source /<PARENTDIR>/compilers_and_libraries_2021.<update number>.<package number>/bin/setvars.csh intel64
    Or issue the following command using a BASH-style shell:
    /usrs/users/me$ . /<PARENTDIR>/compilers_and_libraries_2021.<update number>.<package number>/bin/setvars.sh intel64
    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 .cshrc, .bashrc, or other shell startup file.
  3. From the command window, issue the following command:
    /usrs/users/me$ ifort –o hello hello.f90
  4. Now you have an executable called "hello", which can be run and will give immediate feedback.
    /usrs/users/me$ hello hello!

Next Steps

Product and Performance Information

1

Performance varies by use, configuration and other factors. Learn more at www.Intel.com/PerformanceIndex.