How to maintain environment variable set in Shell?

I was trying to execute files that load Pardiso.jl which requires an environment variable MKLROOT. I have set MKLROOT in shell (zsh) by having source /opt/intel/mkl/bin/ intel64 in .zshrc. The package works normally if I start Julia from Zsh. But, it won’t work (warning MKLROOT not set) if I execute the file in VSCode using the extension command.

Is there anyway to get this fixed?

Update: The issue disappeared after I restart my computer. Sorry for wasting your time.

From the intel docs, add the line to ~/.profile. Then log-out & re-log-in.

Which one exactly? There are various ways to run code in VS Code (in the REPL, as a standalone process, in the debugger etc.).

In general, if you start VS Code from a shell where these env vars are set, the VS Code process and any Julia process you start from VS Code should inherit these. If not, it is a bug.