I'm using Chrome's native messaging to trigger an executable file that begins with:
#!/usr/bin/env node
<js code here>
The problem is that when the executable is triggered, the /usr/bin/env
command has a different set of variables than when I trigger it directly from my shell. Importantly, PATH
does not contain my node binary (/Users/username/.nvm/versions/node/v6.11.1/bin)
The problem only occurs when I click on the Chrome icon in my dock. If I start the Chrome browser through the command line, everything works.
I suspect the problem lies in the two ways Chrome opens (/Chrome.app/Contents/MacOS/Chrome vs clicking the dock icon), that changes the environment that the executable is run in.
How do I access the real PATH variable from within the context of Chrome's triggered executable?