ZSH And VSCode - Default Shells

Viewed 35391

I've started setting up ZSH for VSCode. It worked for a small bit, but then it changed to Git Bash (my previous default shell). I tried changing the shell back to ZSH, but it didn't display in the list of opinions. Though, it does display WSL, which displays a completely different theme

My theme (in windows terminal, unbuntu, ect):
My theme
The theme that is in VSCode:
WSL defaulted theme

I've tried adding this to my settings.json:

"terminal.integrated.shell.windows": "/bin/zsh",

But it says: "The terminal process failed to launch: Path to shell executable "\bin\zsh" does not exist."

How can I fix this (change the default shell back to ZSH)?

4 Answers

Try which zsh to confirm the path of your zsh executable. You might be having path error.

which zsh

Or Try the GUI way.

  1. Open Command Palette

Windows - Ctrl + Shift + P

Mac - ⌘ + Shift + P

  1. Search For Terminal: Select Default Shell and select it.

Command Palette

  1. See the list of available shells and select one. If you cannot see zsh here, then you might have some configuration issues with zsh.

Available Shells

It also likely that the zsh installation/configuration error caused your entry in settings.json file to be invalid. Once you have selected the shell, hit ctrl + ~ or ⌘ + J to open the terminal window and see the results. If you already opened a terminal then you would have to trash it or open another one.

You could also open your settings.json and see or add the following entry directly.

// Edit July 2021 - New Updated Snippet
"terminal.integrated.defaultProfile.osx": "zsh"

// Now deprecated
"terminal.integrated.shell.osx": "/bin/zsh"

Looks like it has changed slightly on Macs.

Mac - ⌘ + Shift + P

Type "Terminal: Select Default Profile", and select it.

enter image description here

Then you will see this:

enter image description here

Choose bash or whatever, and then you must close and restart VS Code.

Here's the solution:

terminal.integrated.shell.osx has been deprecated for terminal.integrated.defaultProfile.osx (shell to defaultProfile) but the new rule instead defaults to bash (at the time of this post)

What actually happens is this: (got it by using the GUI instead) - it's the path. terminal.integrated.defaultProfile.osx actually works, but the value has to be changed from /bin/zsh to zsh.

So the setting should be "terminal.integrated.defaultProfile.osx": "zsh" instead of "terminal.integrated.defaultProfile.osx": "/bin/zsh".

Also note the language changed from Default shell to defaultProfile.

open "~/.config/Code/User/settings.json"

add your default shell depending on you OS:

"terminal.integrated.defaultProfile.linux": "zsh"
"terminal.integrated.defaultProfile.osx": "zsh"
"terminal.integrated.defaultProfile.windows": "zsh"
Related