# How to maintain environment variable set in Shell?

**URL:** <https://discourse.julialang.org/t/how-to-maintain-environment-variable-set-in-shell/42763>\
**Category:** VS Code\
**Tags:** question\
**Created:** [July 9, 2020, 12:24am UTC](https://discourse.julialang.org/t/how-to-maintain-environment-variable-set-in-shell/42763 "2020-07-09T00:24:43Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![Norman](https://avatars.discourse-cdn.com/v4/letter/n/97f17d/32.png) [@Norman](https://discourse.julialang.org/u/Norman)\
**Post date:** [July 9, 2020, 12:24am UTC](https://discourse.julialang.org/t/how-to-maintain-environment-variable-set-in-shell/42763/1 "2020-07-09T00:24:43Z")

</div>

I was trying to execute files that load [Pardiso.jl](https://github.com/JuliaSparse/Pardiso.jl) which requires an environment variable `MKLROOT`. I have set `MKLROOT` in shell (zsh) by having `source /opt/intel/mkl/bin/mklvars.sh 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.

---

<div class="post-metadata">

**Author:** ![Wen-Wei\_Tseng](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/wen-wei_tseng/32/28839_2.png) [@Wen-Wei\_Tseng](https://discourse.julialang.org/u/Wen-Wei_Tseng)\
**Post date:** [July 9, 2020, 2:06am UTC](https://discourse.julialang.org/t/how-to-maintain-environment-variable-set-in-shell/42763/2 "2020-07-09T02:06:49Z")

</div>

> [@Norman](#):
>
> /opt/intel/mkl/bin/mklvars.sh

From the intel [docs](https://software.intel.com/content/www/us/en/develop/documentation/mkl-linux-developer-guide/top/getting-started/setting-environment-variables/automating-the-process-of-setting-environment-variables.html), add the line to ` ~/.profile`. Then log-out & re-log-in.

---

<div class="post-metadata">

**Author:** ![davidanthoff](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/davidanthoff/32/223493_2.png) [@davidanthoff](https://discourse.julialang.org/u/davidanthoff)\
**Post date:** [July 9, 2020, 9:06pm UTC](https://discourse.julialang.org/t/how-to-maintain-environment-variable-set-in-shell/42763/3 "2020-07-09T21:06:12Z")

</div>

> [@Norman](#):
>
> execute the file in VSCode using the extension command

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.
