Reputation: 317
After following these instructions to update Bash and set it as my default shell on macOS, I found that it didn't have any effect on the integrated terminal in VSCode. As shown by:
echo $0
which returned /bin/bash
instead of /opt/homebrew/bin/bash
.
and
echo $BASH_VERSION
which returned 3.2.57(1)-release
instead of 5.1.12(1)-release
(or later).
Applying the same instructions inside VSCode, using sudo
on chsh
and setting "Terminal > integrated > Default Profile: Osx" to "Bash" all didn't have any effect.
How do I fix this?
Download newest Bash version using Homebrew: brew install bash
.
Whitelist updated version (path: /opt/homebrew/bin/bash
) to /etc/shells
using Vim.
Set as default shell using chsh -s /opt/homebrew/bin/bash
.
Upvotes: 4
Views: 2211
Reputation: 633
Install bash with brew using brew install bash
.
Confirm the installation with /opt/homebrew/bin/bash --version
.
Add this bash to the login shell with
echo 'eval "$(/opt/homebrew/bin/brew shellenv)"' >> .bash_profile
Reference of this step is this answer.
Open Settings in VS Code with command + ,
.
Search the corresponding setting with the keyword terminal.integrated.profiles.osx and click Edit in settings.json.
Add a new bash-5.2
profile with
"bash-5.2": {
"path": "/opt/homebrew/bin/bash",
"args": [
"-l"
],
"icon": "terminal-bash"
},
Note, the -l
option above tells Bash to behave as if it were a login shell, which would load eval
step we saved above in .bash_profile
.
Upvotes: 0
Reputation: 317
Simply add the following line to settings.json
(which can be found inside settings) to override the original path:
// "...",
"terminal.integrated.shell.osx": "/opt/homebrew/bin/bash",
// "...",
After I posted this answer I found out that this method is deprecated.
The right way to do it is by making a new terminal profile and setting it as your default:
// "...",
"terminal.integrated.profiles.osx": {
"new bash": { // profile name
"path": "/opt/homebrew/bin/bash"
}
},
"terminal.integrated.defaultProfile.osx": "new bash",
// "...",
Upvotes: 3