VSCode Integrated Terminal Doesn't Load .bashrc or .bash_profile

后端 未结 4 1417
抹茶落季
抹茶落季 2020-12-17 10:16

I have the following files to handle shell configuration:

#~/.bash_profile
if [ -f ~/.bashrc ]; then
   source ~/.bashrc
fi

and

<         


        
相关标签:
4条回答
  • 2020-12-17 10:45

    Simply add shell args to the settings. Tested on Windows with git bash but it should work same on Osx and Linux.

    In C:\Users\<username>\AppData\Roaming\Code\User\settings.json or where your windows setting is: Add one of the following:

    "terminal.integrated.shellArgs.windows": ["-l"],
    
    "terminal.integrated.shellArgs.linux": ["-l"],
    
    "terminal.integrated.shellArgs.osx": ["-l"],
    

    just below "terminal.integrated.shell.<platform>...

    This will launch bash with the login argument.

    0 讨论(0)
  • 2020-12-17 10:45

    You could also try the following:

    1 Create a file named /usr/local/bin/bash-login and add :

    #!/bin/bash
    bash -l
    

    2 Run:

    chmod +x /usr/local/bin/bash-login 
    

    to make it executable.

    3 On your VSC user settings add

       { "terminal.integrated.shell.osx": "/usr/local/bin/bash-login" }
    

    The solution was described at https://github.com/Microsoft/vscode/issues/7263.

    Hope it helps

    0 讨论(0)
  • 2020-12-17 10:47

    I had the same problem with the Intellij Idea terminal on a Mac, the solution is the same for both. In settings change the path to the integrated terminal to "/bin/bash". Hope that helps.

    0 讨论(0)
  • 2020-12-17 11:05

    Another possible solution that just worked for me. The settings.json file (whcih you can access in File > Preferences > Settings > Features > terminal > Integrated > Automation Shell: Linux) had a parameter

        "terminal.integrated.inheritEnv": false
    

    set to false by default. Changing it to true fixed the problem in my case.

    0 讨论(0)
提交回复
热议问题