I have the option "Reopen windows when logging back in" set, which on my 11.6 macbook will reopen apps like vscode and iTerm2 after I restart. I want the reopened windows to have the expected environment variables set.
Most apps will reopen with no problem, but in vscode I'll get the error
The terminal process failed to launch: Path to shell executable "pwsh" does not exist. As far as I can tell, the problem is related to the system procedure for creating
PATH not running for windows reopened at login. By launching bash I can see the process
PATH environment variable is something like
/usr/bin:/bin:/usr/sbin:/sbin which explains the
"pwsh" does not exist error... (because
pwsh is in
/usr/local/bin/ which normally is in my
PATH but is missing here.)
I could solve the immediate problem by specifying the full path to my shell executable in my vscode config, but other tools like
pyenv shims and
gcloud are also missing from the
PATH so this doesn't solve the root problem.
Is there some macOS setting I can change so that reopened windows have the right environment variables?
Or, I see that when iTerm2 reopens it starts my
pwsh shell and somehow has the correct
PATH -- could the vscode app copy the startup logic from iTerm2 to start with the right environment variables?