Programming Guide


Use the setvars Script with Linux* or MacOS*

Most of the component tool folders contain an environment script named
that configures the environment variables needed by that component to support oneAPI development work. For example, in a default installation, the
vars script on Linux or macOS is located at:
. This pattern is shared by all oneAPI components that include an environment
These component tool
scripts can be called directly or collectively. To call them collectively, a script named
is provided in the oneAPI installation folder. For example, in a default installation on a Linux or macOS machine:
Sourcing the
script without any arguments causes it to locate and source all of the
scripts installed on the system. Changes made to the environment using the
command can be seen after sourcing these scripts.
Changes to your environment made by sourcing the
script (or the individual
scripts) are not permanent. Those changes only apply to the terminal session in which the
environment script was sourced.

Command Line Arguments

script supports several command-line arguments, which are displayed using the
option. For example:
source /opt/intel/oneapi/ --help
Of particular note are the
argument and the ability to include additional arguments that will be passed to the
scripts that are called by the
argument provides the ability to limit environment initialization to a specific set of oneAPI components, as well as providing a way to initialize the environment for a specific component version. For example, to limit environment setup to just the Intel® Integrated Performance Primitives (Intel® IPP) library and the Intel® oneAPI Math Kernel Library (oneMKL), create a config file that tells the
script to only configure the environment variables for those two oneAPI components. More details and examples are provided in Use a Config file for on Linux or macOS.
Any extra arguments passed on the
command line that are not described in the
help message will be passed to every called
script. That is, if the
script does not recognize an argument, it assumes the argument is meant for use by one or more component scripts and passes those extra arguments to every component
script that it calls. The most common extra arguments are the
arguments, which are used by the Intel compilers and the Intel IPP and oneMKL libraries to indicate the application target architecture.
Inspect the individual
scripts to determine which, if any, command line arguments they accept.

How to Run

source <install-dir>/
If you are using a non-POSIX shell, such as csh, use the following command:
% bash -c 'source <install-dir>/ ; exec csh'
Alternatively, use the modulefiles scripts to set up your development environment. The modulefiles scripts work with all Linux shells.

How to Verify

After running the
script, verify success by searching for the
environment variables. If
was successful,
will have a value of 1:
Return value

Multiple Runs

Because many of the individual
scripts make significant changes to PATH, CPATH, and other environment variables, the top-level
script will not allow multiple invocations of itself in the same session. This is done to ensure that your environment variables do not become too long due to redundant path references, especially the
environment variable.
This can be overridden by passing
flag. In this example, the user tries to run
twice. The second instance is stopped because
has already been run.
> source <install-dir>/ :: initializing environment ... (SNIP: lot of output) :: oneAPI environment initialized ::
> source <install-dir>/ :: WARNING: has already been run. Skipping re-execution. To force a re-execution of, use the '--force' option. Using '--force' can result in excessive use of your environment variables
In the third instance, the user runs --force
and the initialization is successful.
> source <install-dir>/ --force :: initializing environment ... (SNIP: lot of output) :: oneAPI environment initialized ::

ONEAPI_ROOT Environment Variable

variable is set by the top-level
script when that script is sourced. If there is already a
environment variable defined,
overwrites it. This variable is primarily used by the
sample browser and the Eclipse* and Visual Studio Code* sample browsers to help them locate oneAPI tools and components, especially for in locating the
script if the
feature has been enabled. For more information on the
feature, see Automate the Script with Eclipse*.
On Linux and macOS systems, the installer does not add the
variable to the environment. To add it to the default environment, define the variable in your local shell initialization file(s) or in the system's

Product and Performance Information


Performance varies by use, configuration and other factors. Learn more at