# ENV\["PATH"\] is different for REPL started through VS Code

**URL:** <https://discourse.julialang.org/t/env-path-is-different-for-repl-started-through-vs-code/105253>\
**Category:** General Usage\
**Tags:** vscode\
**Created:** [October 20, 2023, 10:32pm UTC](https://discourse.julialang.org/t/env-path-is-different-for-repl-started-through-vs-code/105253 "2023-10-20T22:32:37Z")\
**Posts on this page:** 15\
**Page:** 1

<div class="post-metadata">

**Author:** ![dylan-asmar](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/dylan-asmar/32/30577_2.png) [@dylan-asmar](https://discourse.julialang.org/u/dylan-asmar)\
**Post date:** [October 20, 2023, 10:32pm UTC](https://discourse.julialang.org/t/env-path-is-different-for-repl-started-through-vs-code/105253/1 "2023-10-20T22:32:37Z")

</div>

If I start the REPL using VS Code (Julia: Start REPL), I get different results for `ENV["PATH"]` than if I start the REPL in any other way.

VS Code: Version 1.83.1  
Julia: 1.9.3  
OS: MacOS Sonoma 14.0

I am assuming it is a setting with the Julia extension in VS Code, but I can’t seem to find it.

---

<div class="post-metadata">

**Author:** ![kevbonham](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/kevbonham/32/216165_2.png) [@kevbonham](https://discourse.julialang.org/u/kevbonham)\
**Post date:** [October 20, 2023, 10:37pm UTC](https://discourse.julialang.org/t/env-path-is-different-for-repl-started-through-vs-code/105253/2 "2023-10-20T22:37:56Z")

</div>

What are the differences?

---

<div class="post-metadata">

**Author:** ![dylan-asmar](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/dylan-asmar/32/30577_2.png) [@dylan-asmar](https://discourse.julialang.org/u/dylan-asmar)\
**Post date:** [October 20, 2023, 10:42pm UTC](https://discourse.julialang.org/t/env-path-is-different-for-repl-started-through-vs-code/105253/3 "2023-10-20T22:42:52Z")

</div>

The main problem is that I don’t have access to some executables that I would expect.

From the REPL started in VS Code:

```plaintext
julia> ENV["PATH"]
"/usr/bin:/bin:/usr/sbin:/sbin"

```

From a REPL started in the terminal:

```plaintext
julia> ENV["PATH"]
"/Users/dylan/.juliaup/bin:/Users/dylan/opt/anaconda3/bin:/Users/dylan/opt/anaconda3/condabin:/opt/homebrew/bin:/opt/homebrew/sbin:/usr/local/bin:/System/Cryptexes/App/usr/bin:/usr/bin:/bin:/usr/sbin:/sbin:/Applications/CMake.app/Contents/bin:/var/run/com.apple.security.cryptexd/codex.system/bootstrap/usr/local/bin:/var/run/com.apple.security.cryptexd/codex.system/bootstrap/usr/bin:/var/run/com.apple.security.cryptexd/codex.system/bootstrap/usr/appleinternal/bin:/Library/Apple/usr/bin:/Library/TeX/texbin"

```

---

<div class="post-metadata">

**Author:** ![dylan-asmar](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/dylan-asmar/32/30577_2.png) [@dylan-asmar](https://discourse.julialang.org/u/dylan-asmar)\
**Post date:** [October 20, 2023, 10:46pm UTC](https://discourse.julialang.org/t/env-path-is-different-for-repl-started-through-vs-code/105253/4 "2023-10-20T22:46:36Z")

</div>

Just as a follow-up here is an example.

REPL started through VS Code:

```plaintext
shell> lualatex -v
zsh:1: command not found: lualatex

```

REPL started in the terminal:

```plaintext
shell> lualatex -v
This is LuaHBTeX, Version 1.16.0 (TeX Live 2023)
Development id: 7567

Execute 'luahbtex --credits' for credits and version details.

There is NO warranty. Redistribution of this software is covered by
the terms of the GNU General Public License, version 2 or (at your option)
any later version. For more information about these matters, see the file
named COPYING and the LuaTeX source.

LuaTeX is Copyright 2022 Taco Hoekwater and the LuaTeX Team.

```

---

<div class="post-metadata">

**Author:** ![kevbonham](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/kevbonham/32/216165_2.png) [@kevbonham](https://discourse.julialang.org/u/kevbonham)\
**Post date:** [October 21, 2023, 1:36am UTC](https://discourse.julialang.org/t/env-path-is-different-for-repl-started-through-vs-code/105253/5 "2023-10-21T01:36:18Z")

</div>

I have a vague recollection when I used to use amac that of I used the Julia from the downloaded `.dmg`, it didn’t have access to my normal shell, but if I opened it from the terminal, I did.

There’s a vs code setting for how to launch Julia, maybe check to make sure that’s calling the one from juliaup?

---

<div class="post-metadata">

**Author:** ![nsajko](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/nsajko/32/221187_2.png) [@nsajko](https://discourse.julialang.org/u/nsajko)\
**Post date:** [October 21, 2023, 9:56am UTC](https://discourse.julialang.org/t/env-path-is-different-for-repl-started-through-vs-code/105253/6 "2023-10-21T09:56:09Z")

</div>

How do you start VS Code? Do you use some kind of isolation, such as Flatpak or Snap?

---

<div class="post-metadata">

**Author:** ![skleinbo](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/skleinbo/32/36080_2.png) [@skleinbo](https://discourse.julialang.org/u/skleinbo)\
**Post date:** [October 21, 2023, 9:56am UTC](https://discourse.julialang.org/t/env-path-is-different-for-repl-started-through-vs-code/105253/7 "2023-10-21T09:56:12Z")

</div>

Launch VSCode from the terminal, if you need it to inherit environment variables set in `~/.bash_profile` or similar.

---

<div class="post-metadata">

**Author:** ![dylan-asmar](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/dylan-asmar/32/30577_2.png) [@dylan-asmar](https://discourse.julialang.org/u/dylan-asmar)\
**Post date:** [October 21, 2023, 9:05pm UTC](https://discourse.julialang.org/t/env-path-is-different-for-repl-started-through-vs-code/105253/8 "2023-10-21T21:05:14Z")

</div>

I have not used any special way of starting or installing VS Code.

---

<div class="post-metadata">

**Author:** ![nsajko](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/nsajko/32/221187_2.png) [@nsajko](https://discourse.julialang.org/u/nsajko)\
**Post date:** [October 21, 2023, 9:05pm UTC](https://discourse.julialang.org/t/env-path-is-different-for-repl-started-through-vs-code/105253/9 "2023-10-21T21:05:42Z")

</div>

So how do you start it then? (And how is it installed, etc.)

---

<div class="post-metadata">

**Author:** ![dylan-asmar](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/dylan-asmar/32/30577_2.png) [@dylan-asmar](https://discourse.julialang.org/u/dylan-asmar)\
**Post date:** [October 21, 2023, 9:06pm UTC](https://discourse.julialang.org/t/env-path-is-different-for-repl-started-through-vs-code/105253/10 "2023-10-21T21:06:30Z")

</div>

Starting from the terminal produces the same results. That is, I still don’t have access to my default PATH

---

<div class="post-metadata">

**Author:** ![dylan-asmar](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/dylan-asmar/32/30577_2.png) [@dylan-asmar](https://discourse.julialang.org/u/dylan-asmar)\
**Post date:** [October 21, 2023, 9:09pm UTC](https://discourse.julialang.org/t/env-path-is-different-for-repl-started-through-vs-code/105253/11 "2023-10-21T21:09:30Z")

</div>

Sorry, I might be misunderstanding your question and I might be lacking the knowledge on what you are trying to get at. In the most basic sense, I downloaded Visual Studio Code from the website ([https://code.visualstudio.com/](https://code.visualstudio.com/)). I selected the Mac Universal Stable Build. It comes as a zip, I unzip it and drag the app into the Applications folder on Mac. Then I just execute the .app when I want to start VS Code.

As mentioned by @skleinbo , I have also started it from the terminal using the `code` command.

---

<div class="post-metadata">

**Author:** ![dylan-asmar](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/dylan-asmar/32/30577_2.png) [@dylan-asmar](https://discourse.julialang.org/u/dylan-asmar)\
**Post date:** [October 21, 2023, 9:11pm UTC](https://discourse.julialang.org/t/env-path-is-different-for-repl-started-through-vs-code/105253/12 "2023-10-21T21:11:30Z")

</div>

Additionally, when I use the integrated terminal inside VSCode, I am not experiencing the same issue. This seems to have something to do with launching the REPL with the Julia extension through VSCode.

---

<div class="post-metadata">

**Author:** ![kevbonham](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/kevbonham/32/216165_2.png) [@kevbonham](https://discourse.julialang.org/u/kevbonham)\
**Post date:** [October 22, 2023, 9:26am UTC](https://discourse.julialang.org/t/env-path-is-different-for-repl-started-through-vs-code/105253/13 "2023-10-22T09:26:21Z")

</div>

> [@dylan-asmar](#):
>
> I unzip it and drag the app into the Applications folder on Mac

Yeah, applications like this launch in their own shell process and don’t have access to your user-specific stuff.

If you right click this app in Finder, then “explore contents” (or something like that), then look for the `bin/julia` file. Right click that, and then copy the path to that file.

Use that to launch Julia instead. It’s weird that vs code uses that to launch an external REPL, but not for the internal one though

---

<div class="post-metadata">

**Author:** ![fcdimitr](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/fcdimitr/32/26613_2.png) [@fcdimitr](https://discourse.julialang.org/u/fcdimitr)\
**Post date:** [February 16, 2024, 3:31pm UTC](https://discourse.julialang.org/t/env-path-is-different-for-repl-started-through-vs-code/105253/14 "2024-02-16T15:31:18Z")

</div>

I have the same issue, `Weave.jl` is not working from the `REPL` inside `VSCode` but works fine from the terminal. Did you figure out any workarounds (such as a way to change the path in Julia only when opened in VScode)?

---

<div class="post-metadata">

**Author:** ![dylan-asmar](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/dylan-asmar/32/30577_2.png) [@dylan-asmar](https://discourse.julialang.org/u/dylan-asmar)\
**Post date:** [February 16, 2024, 7:03pm UTC](https://discourse.julialang.org/t/env-path-is-different-for-repl-started-through-vs-code/105253/15 "2024-02-16T19:03:54Z")

</div>

I did not find a suitable workaround. I just changed my workflow for now.
