PATH for the app is limited. Most commands that I want to run, like docker, are not in PATH for the app. This makes it very limited regarding what I can write in the plugins.
Would like to know what people are doing for this. I would also like to make a recommendation that PATH from login shell is somehow incorporated, as the premise is running custom scripts that work in our terminals.
export PATH='/usr/local/bin:$PATH'
in the plugin is a workaround for now.
Perhaps you could add that to the README? It's a cool little trick.
Do you think this requires a change in BitBar, or is adding the path 'manually' a good solution?
How do you export PATH if your script isn't using bash?
@uri depends on what language you're using.
A more portable solution might be to have the app pull PATH from a login shell session on reset - this is the strategy used in neovim.app (see https://github.com/rogual/neovim-dot-app/blob/master/src/app.mm)
+1 to @alaroldai
The trouble is, which login shell should it pull from? People use different ones. And which file? .bash_profile, .bash_rc, or something else?
It seems more elegant to let the plugin developer decide what to pull in?
Well, it is possible to check which shell the user has set as their default shell. On Mac OS, you can do this with: dscl . read /Users/alaroldai UserShell | cut -f2 -d' '. There's also the OpenDirectory framework, which afaik is the underlying implementation of users, groups, shells, and lots of other stuff as well. I believe that iTerm2 uses this approach, though running dscl in a subprocess might be simpler for a quick win/proof-of-concept.
Are we happy that this issue is resolved in userland?
Yea
Just in case anybody else is wondering for a moment why @manojlds's solution above is not working for them: Use double quotes instead of single quotes so that $PATH actually gets expanded.
i.e. PATH="/usr/local/bin:$PATH"
Most helpful comment
export PATH='/usr/local/bin:$PATH'in the plugin is a workaround for now.