ZSH And VSCode - Default Shells
Asked Answered
L

4

32

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)?

Liquorice answered 22/9, 2020 at 0:53 Comment(1)
Have you tried something like "terminal.integrated.shell.windows": "wsl.exe -d Ubuntu-20.04 -e /bin/zsh".Student
C
54

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"
Churchgoer answered 5/1, 2021 at 11:32 Comment(4)
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)Grisette
It worked! Thank you. In my VS code on Ubuntu the command is: Terminal: Select Default ProfileLateshalatest
editing settings.json and then restarting code worked for me. thanks.Tartar
i don't have the /bin/zsh even listed (ubuntu), any idea why and how do i add it?Francescafrancesco
P
41

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.

Pushkin answered 12/7, 2021 at 13:26 Comment(2)
Not on Mac, but for all. Terminals now have profiles and OS-specific settings.Weatherman
Key thing is to restart VS Code, not to force reload the windowBosom
G
20

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.

Grisette answered 10/5, 2021 at 14:36 Comment(3)
Is this already working? Because the zsh profile appears but unless I use the deprecated command it keeps opening bash as the first option.Lasonde
It is working. Not sure what your exact challenge is, but I noticed I had to close and reopen all terminal instances in my saved workspaces - since they were all defaulting to bash after the change - but after that everything works fine.Grisette
defaultProfile saved me :)Hydrometer
A
9

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"
Accused answered 26/10, 2021 at 15:18 Comment(2)
For me, this was the path to settings: /Library/Application Support/Code/User/settings.jsonWickliffe
Depending on how you installed VS Code on a Mac, it may also be located at ~/Library/Application Support/Code/User/settings.jsonShanley

© 2022 - 2024 — McMap. All rights reserved.