PATH not updated correctly from conda activate in VSCode’s terminal

This behavior is explained in the VSCode docs:
Why are there duplicate paths in the terminal’s $PATH environment variable and/or why are they reversed?#

It sounds like VSCode will run your .zshrc twice in MacOS, conflicting with the conda-generated PATH variable definitions.

There are two solutions listed in the link above. The one that works for me is to set the VSCode setting "terminal.integrated.inheritEnv": false. The documentation warns that all of your environmental variables will be stripped if you do this. However, I find I still have my custom variables defined in the .zshrc file.

It is worth noting that recent versions of VSCode will prompt you when it detects you are using a conda environment, and suggests making this change.

Leave a Comment