VSCode Integrated Terminal Doesn't Load .bashrc or .bash_profile
Simply add shell arguments to the VsCode settings.json
file.
Paths to the settings.json
file are as follows:
Windows: C:\Users\<username>\AppData\Roaming\Code\User\settings.json`
Linux: $HOME/.config/Code/User/settings.json
Mac: $HOME/Library/Application\ Support/Code/User/settings.json
Add one of the following:
"terminal.integrated.shellArgs.windows": ["-l"],
"terminal.integrated.shellArgs.linux": ["-l"],
"terminal.integrated.shellArgs.osx": ["-l"],
This will launch your shell of choice with the login argument. This will thus execute any user profile that is setup.
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.
VSCode has deprecated "terminal.integrated.shellArgs.osx"
in favor of using profiles. This does the trick for bash in osx. Omit the first line if you don't want bash to be your default profile:
"terminal.integrated.defaultProfile.osx": "bash",
"terminal.integrated.profiles.osx": {
"bash": {
"path": "bash",
"args": ["-l"]
}
}
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.
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