在 macOS Big Sur 上,我安装了 MacPorts 并使用它安装了 bash。/opt/local/bin/bash我通过使用将默认 shell 设置为 MacPorts 版本的 bash chsh。
一切都好。
我决定宁愿使用 Homebrew。我卸载了 MacPorts,安装了 Homebrew,通过 homebrew 安装了 bash,并将默认 shell 设置为/opt/homebrew/bin/bashvia chsh。
一切都很好,除了当我第一次启动 vscode(从 Finder)时报告:
Unable to resolve your shell environment: A system error occurred (spawn /opt/local/bin/bash ENOENT)
Run Code Online (Sandbox Code Playgroud)
这是一个完全合理的抱怨,因为该二进制文件不再存在。当从 Finder 启动时,它会发出此抱怨,但从终端启动时则不会。我的用户文件中没有引用此先前版本的 bash settings.json,我的.bashrc.
vscode 到底从哪里得到 bash 的这条路径?!
编辑(2021-10-11):这里发生了一些奇怪的事情。如果我在 vscode 中打开集成终端:
Unable to resolve your shell environment: A system error occurred (spawn /opt/local/bin/bash ENOENT)
Run Code Online (Sandbox Code Playgroud)
(常规 macOS 终端应用程序不存在此类问题)
再次编辑(2021-10-12):