vscode: Things missing from PATH variable in OS X Big Sur

  • VS Code Version: (various)
  • OS Version: OS X Big Sur

We have not been able to reproduce this issue ourselves, but have seen a lot of users hitting problems with the PATH variable missing some things on Big Sur. It does not happen when running the Terminal app nor within terminals manually-launched within VSCode, but does seem to happen when things execute as tasks or in the background via child_process.

As a result of missing entries, commands like docker ... fail.

~~https://github.com/microsoft/vscode-docker/issues/2758~~ (ended up being terminal.integrated.inheritEnv == false) https://github.com/microsoft/vscode-docker/issues/2366 https://github.com/microsoft/vscode-docker/issues/2254 https://github.com/microsoft/vscode-docker/issues/2574 https://github.com/microsoft/vscode-docker/issues/2577

Maybe related to https://github.com/microsoft/vscode/issues/115738 or https://github.com/microsoft/vscode/issues/21655?

About this issue

  • Original URL
  • State: closed
  • Created 3 years ago
  • Reactions: 3
  • Comments: 31 (13 by maintainers)

Commits related to this issue

Most upvoted comments

@deepak1556 we’ve made a lot of changes in the Docker extension too; likely they will make it more sensitive to issues with $PATH. So far we haven’t seen any customer reports of problems that look like $PATH issues, but I’ll respond back if we see anything.

I can confirm this to be an ongoing issue in macOS Monterey 12.2.1 and VSCode 1.65.2.

To reproduce:

  • Include ${env:PATH} in the path set in terminal.integrated.env.osx in workspace or user settings
  • Launch VS Code in macOS from the Dock or otherwise without using the command line
  • Run a task without an explicit PATH setting

Result:

  • the PATH in the environment Code runs under is set by launchd(8)/launchctl(8), by default /usr/bin:/bin:/usr/sbin:/sbin; this can be verified in the Developer Tools console as process.env
  • the PATH in the environment the task runs under is then also /usr/bin:/bin:/usr/sbin:/sbin

Workaround:

  • if PATH is not set in terminal.integrated.env.osx, tasks will set it from the environment used in a typical interactive login shell for the user (some caveats apply; this partially contradicts the documentation at https://code.visualstudio.com/docs/editor/tasks#_why-do-i-get-command-not-found-when-running-a-task)
  • if PATH is set in the options.env settings for the task, this will override the terminal.integrated.env.osx setting; non-intuitively (as noted in #145434), ${env:PATH} in the task options does substitute the PATH from a typical interactive login shell rather than the environment Code is running under.