尝试which zsh
以确认您的zsh可执行文件的路径。可能存在路径错误。
或者尝试使用GUI方式。
Windows - Ctrl
+ Shift
+ P
Mac - ⌘
+ Shift
+ P
Terminal: Select Default Shell
并选择它。也有可能zsh的安装/配置错误导致了您在settings.json
文件中的输入无效。选择shell后,按ctrl
+ ~
或⌘
+ J
打开终端窗口并查看结果。如果您已经打开了终端,则必须将其删除或打开另一个终端。
您还可以打开settings.json
,直接查看或添加以下条目。
// Edit July 2021 - New Updated Snippet
"terminal.integrated.defaultProfile.osx": "zsh"
// Now deprecated
"terminal.integrated.shell.osx": "/bin/zsh"
terminal.integrated.shell.osx
被弃用,使用 terminal.integrated.defaultProfile.osx
替代(从 shell
改为 defaultProfile
),但新规则默认使用 bash(在本文发布时)。 - kawerewagabaterminal.integrated.shell.osx
已被弃用,应使用terminal.integrated.defaultProfile.osx
(从shell
改为defaultProfile
),但新规则默认使用bash(在此帖子发布时)。
实际情况是这样的:(通过GUI获得)——这是路径的问题。 terminal.integrated.defaultProfile.osx
确实可行,但值必须从/bin/zsh
更改为zsh
。
因此,设置应该是"terminal.integrated.defaultProfile.osx": "zsh"
而不是"terminal.integrated.defaultProfile.osx": "/bin/zsh"
。
还要注意语言从默认shell
更改为defaultProfile
。defaultProfile
救了我 :) - Sorush打开 "~/.config/Code/User/settings.json" 文件
根据你的操作系统添加默认的shell:
"terminal.integrated.defaultProfile.linux": "zsh"
"terminal.integrated.defaultProfile.osx": "zsh"
"terminal.integrated.defaultProfile.windows": "zsh"
/Library/Application Support/Code/User/settings.json
。 - undefined
"terminal.integrated.shell.windows": "wsl.exe -d Ubuntu-20.04 -e /bin/zsh"
。 - Umair Khan