Intel® Fortran Compiler
Build applications that can scale for the future with optimized code designed for Intel® Xeon® and compatible processors.
27974 Discussions

How to use zsh, csh, or tcsh with oneAPI, or PSXE bash scripts


macOS zsh or other zsh users: currently does not support zsh. 

Simplest workaround is:

bash -c 'source /opt/intel/bin/ intel64 ; exec zsh'

Which will end up with a new zsh instance, so if you exit from the new instance you will lose the env vars.

oneAPI: or compiler/latest/ and other shells:

Same method as above:

# oneAPI use in zsh
bash -c 'source /opt/intel/oneapi/ ; exec zsh'
# oneAPI compiler use in zsh
bash -c 'source /opt/intel/oneapi/compiler/latest/env/ ; exec zsh'


# oneAPI use in csh/tcsh
bash -c 'source /opt/intel/oneapi/ ; exec csh'
# oneAPI compiler use in csh/tcsh
bash -c 'source /opt/intel/oneapi/compiler/latest/env/ ; exec csh'


Startup scripts

WARNING - do not put these in your shell "rc" dot file, for example, ~/.cshrc.  Your shell RC is invoked with each new shell - and notice "exec csh" in this workaround - this will start a subshell, invoke .cshrc, which execs a new shell, the new shell runs .cshrc and you get into an infinite loop.


HOWEVER, Create your Own 'setvars.csh' or zsh or other shell using 'env2'.  Here is an example for tcsh:

You can create your own  setvars.csh 

Read this article and get env2

Then it's simply:

perl ./env2 -from bash -to tcsh /opt/intel/oneapi/ >> setvars.csh


I'd edit the output setvars.csh and add line 1 shell



Then 'chmod +x setvars.csh' and maybe add to /usr/local/bin, or /opt/intel/oneapi or your own ~/bin and source it from your startup dot file.


One-time invocation at login:

For zsh, you can put the workaround(s) in your ~/.zlogin file which is only executed once per login.  See this information on startup scripts for zsh.  Note that with this method, to exit your login you will need to enter the 'exit' command TWICE to terminate your login.

0 Replies