Unable to resolve your shell environment

Unable to resolve your shell environment

Questions : Unable to resolve your shell environment

574

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

All was well.

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

All was well, except when I am first in4codes_visual-studio-code 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, in4codes_visual-studio-code since that binary no longer exists. It makes in4codes_visual-studio-code this complaint when launched from Finder, in4codes_visual-studio-code but not when launched from the terminal. in4codes_visual-studio-code There is no reference to this prior version in4codes_visual-studio-code of bash in my user settings.json file, nor in4codes_visual-studio-code is it in my .bashrc.

Where the heck could vscode be getting this in4codes_visual-studio-code path to bash from?!

Edit (2021-10-11): there is something in4codes_visual-studio-code strange going on here. If I open an in4codes_visual-studio-code 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 in4codes_visual-studio-code 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).

Total Answers 0