Apparently, VS Code adds ~/.local/bin to the PATH before it starts the integrated terminal.
Then when the terminal starts macOS prepends /etc/paths (and probably the stuff in /etc/paths.d) to the PATH, and /etc/paths has /usr/local/bin (and others) by default.
So when ~/.local/bin/env runs, ~/.local/bin is already on the PATH, so it does not prepend it. But it is in the wrong position, because it is after /usr/local/bin, so it does not override system-installed binaries, like it was meant to be.
I verified all this on a vanilla macOS installation with a vanilla VS Code install.
I am not sure what the good fix would be for this, for now my installer will just unconditionally prepend ~/.local/bin/ to the PATH.
Apparently, VS Code adds
~/.local/binto thePATHbefore it starts the integrated terminal.Then when the terminal starts macOS prepends
/etc/paths(and probably the stuff in/etc/paths.d) to thePATH, and/etc/pathshas/usr/local/bin(and others) by default.So when
~/.local/bin/envruns,~/.local/binis already on thePATH, so it does not prepend it. But it is in the wrong position, because it is after/usr/local/bin, so it does not override system-installed binaries, like it was meant to be.I verified all this on a vanilla macOS installation with a vanilla VS Code install.
I am not sure what the good fix would be for this, for now my installer will just unconditionally prepend
~/.local/bin/to thePATH.