Home > Enterprise >  Opening zsh in vscode gives me error (core parameters have unexpectedly changed)
Opening zsh in vscode gives me error (core parameters have unexpectedly changed)

Time:08-09

When opening zsh on the normal terminal I have no errors, while when I open it on vscode I get this:

z4h: core parameters have unexpectedly changed

Expected:

  ZDOTDIR=/Users/*******

Found:

  ZDOTDIR=/var/folders/0f/**************/T/vscode-zsh

Restore the parameters or restart Zsh with exec zsh.

Restore the parameters or restart Zsh with exec zsh.

I installed zsh with z4h and for a while it worked well. Then it started showing this error randomly.

PS: I tried restarting Zsh with exec zsh.

CodePudding user response:

The message shows vscode executes zsh from /var/folders/0f/**************/T/vscode-zsh. But no z4h's setting there. A workaround as below:

  1. Backup if the /var/folders/0f/**************/T/vscode-zsh/.zshenv and /var/folders/0f/**************/T/vscode-zsh/.zshrc that existed in the path

  2. Copy /Users/*******/.zshenv and /Users/*******/.zshrc to /var/folders/0f/**************/T/vscode-zsh/

  3. Restart the terminal on vscode

CodePudding user response:

If it still doesn't work. Another way that execute zsh with the same path. You need to reset the environment variable ZIM_HOME to the Expected path.

  1. In vscode CMD Shift P

  2. Choose Preferences: Open Settings (JSON)

  3. Add a keyname terminal.integrated.profiles.osx

  4. Add the following value to this key.

    {
      "zsh": {
          "path": "/bin/zsh",
          "ZIM_HOME": "/Users/*******/.zim"
      }
    }
    
  5. It would look like as below finally.

    {
     ...
      "terminal.integrated.profiles.osx": {
         "zsh": {
                 "path": "/bin/zsh",
                 "ZIM_HOME": "/Users/*******/.zim"
         }
      }
    ...
    }
    
  6. Restart the terminal.

  • Related