"Unable to resolve your shell environment"

Viewed 2277

On macOS Big Sur, I installed MacPorts and installed bash using it. I set my default shell to the MacPorts version of bash /opt/local/bin/bash by using chsh.

All was well.

I decided I would rather use Homebrew. I uninstalled MacPorts, installed Homebrew, installed bash via homebrew, and set my default shell to /opt/homebrew/bin/bash via chsh.

All was well, except when I am first starting vscode (from Finder) which reports:

Unable to resolve your shell environment: A system error occurred (spawn /opt/local/bin/bash ENOENT)

This is a totally reasonable complaint, since that binary no longer exists. It makes this complaint when launched from Finder, but not when launched from the terminal. There is no reference to this prior version of bash in my user settings.json file, nor is it in my .bashrc.

Where the heck could vscode be getting this path to bash from?!

Edit (2021-10-11): there is something strange going on here. If I open an integrated terminal in vscode:

$ echo $SHELL
/opt/local/bin/bash
$ ls -lh $SHELL
ls: /opt/local/bin/bash: No such file or directory
$ ps -p $$
  PID TTY           TIME CMD
45388 ttys001    0:00.12 /bin/bash -l

(there are no such problems in the regular macOS Terminal app)

Edit again (2021-10-12):

  • I tried resetting vscode (via rm -rf ~/Library/Application\ Support/Code).
  • I tried resetting vscode's cache (via rm -rf ~/Library/Caches/com.microsoft.*),
  • I downloaded iTerm2 and ran it; it loaded the correct shell (/opt/homebrew/bin/bash) without issue (tried this in hopes of determining if there was some other setting in macOS pointing at the old macports version of bash).
0 Answers
Related