skip to Main Content

I’m trying to get VS Code to default to zsh but it seems intent on running bash instead.

I’m on a Mac with OS 13.6.7 installed and I’m following along with the advice in this SO thread as well as this GitHub issue. I’ve updated my settings.json based on that advice:

{
    "terminal.integrated.defaultProfile.osx": "zsh",
    "terminal.integrated.profiles.osx": {
        "zsh": {
            "path": "/bin/zsh",
            "args": [
                "-l",
                "-i"
            ]
        }
    },
    "terminal.integrated.shellIntegration.enabled": false
}

But no matter what I do, as soon as I open up a terminal within VS Code and run echo $SHELL, I get /bin/bash. Meanwhile, if I run the same command in an ordinary terminal, I get /bin/zsh.

When I inspect the default profile within the VS Code GUI it shows zsh as the default:

VS Code default terminal

And the terminal view makes it look like it’s using zsh but an echo $SHELL says otherwise:

VS Code echo shell output

Have read through the VS Code docs and talked to ChatGPT but no luck so far. Any advice?

2

Answers


  1. If you want the SHELL variable to be set, you have to set it. Put into your ~/.zshenv the command

    export SHELL==zsh
    

    and unless one of your other startup files resets the variable, you should be fine.

    My guess is that your account is configured with bash as login shell. By the time your VSC is called, SHELL is set to bash, and this is inherited by your zsh.

    Login or Signup to reply.
  2. If you want the SHELL variable to be set, you have to set it. Put into your ~/.zshenv the command

    export SHELL==zsh
    

    and unless one of your other startup files resets the variable, you should be fine.

    Note: The = is for path name expansion and ensures that the absolute path of your zsh is stored into SHELL.

    My guess is that your account is configured with bash as login shell. By the time your VSC is called, SHELL is set to bash, and this is inherited by your zsh.

    Login or Signup to reply.
Please signup or login to give your own answer.
Back To Top
Search