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

Undistraction picture Undistraction · Aug 13, 2018 · Viewed 19.9k times · Source

I have the following files to handle shell configuration:

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

and

#~/.bashrc
... configure shell

If I open VSCode from the command line using code, my .bashrc is loaded whenever I add a new instance of the integrated shell.

However if I open VSCode via its icon, only my .profile is loaded.

How can I ensure my .bashrc is loaded instead?

I've tried various settings for the terminal.integrated.shellArgs.osx setting without any luck.

Answer

Jose Ananio picture Jose Ananio · May 3, 2019

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.