Set global $PATH environment variable in VS Code

后端 未结 8 1868
温柔的废话
温柔的废话 2020-12-14 02:28

I\'m defining a custom $PATH environment variable in my ~/.bash_profile (on a Mac), like so:

PATH=\"$HOME/.cargo/bin:$PATH:$HOME/bi         


        
8条回答
  •  隐瞒了意图╮
    2020-12-14 03:09

    Visual Studio Code is the problem.

    No matter how you set your PATH variable in the shell, there are cases where Visual Studio Code will not inherit your PATH setting. If you're using an application launcher like LaunchBar to start Visual Studio Code, your PATH variable will not be inherited.

    Here is a system-wide fix:

    In the /etc/paths.d directory, create a file with your Unix username. In that file, place the additional paths that Visual Studio Code needs to work. In my case, this is the contents of my /etc/paths.d file:

    /usr/ucb /opt/local/bin /opt/local/sbin ~/go/bin

    Note: Your /etc/paths.d file will be processed system-wide. Since most systems are single-user, this shouldn't be a problem for most developers.

提交回复
热议问题