Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

PATH is incorrect when using macOS and zsh #133012

Closed
reekystive opened this issue Sep 13, 2021 · 9 comments
Closed

PATH is incorrect when using macOS and zsh #133012

reekystive opened this issue Sep 13, 2021 · 9 comments
Assignees
Labels
*as-designed Described behavior is as designed terminal Integrated terminal issues

Comments

@reekystive
Copy link

Does this issue occur when all extensions are disabled?: Yes

  • VS Code Version:
1.60.0
e7d7e9a9348e6a8cc8c03f877d39cb72e5dfb1ff
arm64
  • OS Version:
macOS Big Sur Version 11.5.2 (20G95)
  • zsh Version:
zsh 5.8 (x86_64-apple-darwin20.0)
# I'm also using Oh My Zsh

Steps to Reproduce:

  1. Open Terminal.app and execute echo $PATH | sed 's/:/\n/g'

Screen Shot 2021-09-14 at 00 59 35

  1. Open Visual Studio Code using code --disable-extensions, open Terminal and execute echo $PATH | sed 's/:/\n/g'

Screen Shot 2021-09-14 at 00 59 37

I found this issue because I couldn't use the correct version of vim. In the above screenshots, the path of vim is different.

Related issue: #107169

@jxjj
Copy link

jxjj commented Sep 14, 2021

I'm also seeing this issue with different $PATHs in VS Code's Terminal and Terminal.app.

Terminal.app:

~ echo $PATH | sed 's/:/\n/g'
/Users/james/.rbenv/shims
/opt/homebrew/opt/openssl@1.1/bin
/Users/james/.rbenv/shims
/Users/james/.deno/bin
/Users/james/.composer/vendor/bin
/Users/james/.nvm/versions/node/v14.17.4/bin
/opt/homebrew/opt/openssl@1.1/bin
/opt/homebrew/bin
/opt/homebrew/sbin
/usr/local/bin
/usr/bin
/bin
/usr/sbin
/sbin
/Library/Apple/usr/bin

VS Code:

~ echo $PATH | sed 's/:/\n/g'
/Users/james/.rbenv/shims
/Users/james/.deno/bin
/Users/james/.composer/vendor/bin
/Users/james/.nvm/versions/node/v14.17.4/bin
/usr/local/bin
/usr/bin
/bin
/usr/sbin
/sbin
/Library/Apple/usr/bin
/Users/james/.rbenv/shims
/opt/homebrew/bin
/opt/homebrew/sbin
/Users/james/.deno/bin
/Users/james/.composer/vendor/bin
/Users/james/.nvm/versions/node/v14.17.4/bin

My Environment

VS Code version:

1.60.1
83bd43bc519d15e50c4272c6cf5c1479df196a4d
arm64

MacOS

ProductName:    macOS
ProductVersion: 11.6
BuildVersion:   20G165

ZSH version (also using Oh-My-Zsh):

zsh 5.8 (x86_64-apple-darwin20.0)

@meganrogge
Copy link
Contributor

I believe this is already fixed, can you see if you can reproduce in the Insiders build?

@meganrogge meganrogge added the info-needed Issue requires more information from poster label Sep 14, 2021
@jxjj
Copy link

jxjj commented Sep 15, 2021

Thanks for looking at this, Megan!

The issue still persists for me this Insider build:

Version: 1.61.0-insider (Universal)
Commit: f66a3e06bcb9f000e5dc0ad0040ff9b32fc75c78
Date: 2021-09-14T05:14:54.400Z
Electron: 13.1.8
Chrome: 91.0.4472.164
Node.js: 14.16.0
V8: 9.1.269.39-electron.0
OS: Darwin arm64 20.6.0

Screen Shot 2021-09-14 at 7 11 29 PM

@meganrogge meganrogge added terminal Integrated terminal issues and removed info-needed Issue requires more information from poster labels Sep 27, 2021
@Tyriar
Copy link
Member

Tyriar commented Oct 7, 2021

You can read about why this happens and how to fix here at https://code.visualstudio.com/docs/editor/integrated-terminal#_why-are-there-duplicate-paths-in-the-terminals-path-environment-variable-andor-why-are-they-reversed

@Tyriar Tyriar added the *as-designed Described behavior is as designed label Oct 7, 2021
@reekystive
Copy link
Author

reekystive commented Oct 7, 2021

In short, if you want your PATH in VSCode Terminal to be the same as in macOS Terminal, just add

"terminal.integrated.inheritEnv": false

to your settings.

I tried it and it worked. I can use the correct version of vim in VSCode now.

@reekystive
Copy link
Author

@reekystive
Copy link
Author

Hi! I found that if I open VSCode with the command code, the PATH will still be incorrect. Can this behavior be changed?

@reekystive
Copy link
Author

I also found that the PATH in VSCode opened with open -a "Visual Studio Code" in zsh is different from the one opened from Finder.

@github-actions github-actions bot locked and limited conversation to collaborators Nov 21, 2021
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
*as-designed Described behavior is as designed terminal Integrated terminal issues
Projects
None yet
Development

No branches or pull requests

5 participants
@jxjj @Tyriar @reekystive @meganrogge and others