Skip to content

fix(pi): use the shell-selected node when launching from finder - #8

Merged
bytesbay merged 1 commit into
bytesbay:mainfrom
jas0ncn:junyi.chen/prefer-shell-node
Dec 1, 2026
Merged

bytesbay merged 1 commit into
bytesbay:mainfrom
jas0ncn:junyi.chen/prefer-shell-node

Conversation

@jas0ncn

@jas0ncn jas0ncn commented Nov 30, 2026

Copy link
Copy Markdown
Contributor

On macOS, the PATH inherited from Finder can include Homebrew’s Node while the login shell selects a different version through mise. With pi installed separately, this caused the version check to fail even though the same pi worked in a terminal.

Keep the executable directory first. When pi has no adjacent Node, look up Node in the login shell, fall back to the inherited PATH, and put the selected directory ahead of the inherited entries.

Verified on macOS with a LaunchServices probe calling the production version check and RPC startup. Both pi processes reported mise Node v26.13.0 via process.execPath. The version check returned pi 1.7.0 and the RPC get_state request succeeded. All five pi module tests passed.

@bytesbay
bytesbay merged commit 692a8c7 into bytesbay:main Dec 1, 2026
@bytesbay

bytesbay commented Dec 1, 2026

Copy link
Copy Markdown
Owner

Thanks, merged and out in 0.2.13. I could reproduce it here with another node ahead on the inherited PATH: the version check failed before and works now.

I added one small change on top (908d7ae). Putting node's directory at the very front has a side effect when it's a shared one like /usr/bin or /opt/homebrew/bin: everything else in it also wins over things like pyenv shims, including in the shell commands the agent runs. So now it goes right before the PATH entry whose node it has to beat, and stays where it is when its node already wins. Your mise setup behaves the same as in your PR.

If it still picks the wrong node on your machine after the update, let me know.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants