Path to default gpg binary
Since M1 macs, homebrew uses /opt/homebrew directory, hence "/opt/homebrew/bin/gpg" should be default path for gpg in this extension?
Is /opt/homebrew/bin not in $PATH, or not first in $PATH? Extension first looks in $PATH, and then just has a couple of fallbacks.
It's not first in PATH:
/opt/homebrew/sbin:/Users/alexanderkim/.yarn/bin:/Users/alexanderkim/.config/yarn/global/node_modules/.bin:/Users/alexanderkim/.nvm/versions/node/v15.14.0/bin:/Users/alexanderkim/bin:/opt/homebrew/bin:/usr/local/bin:/usr/local/sbin:/opt/homebrew/sbin:/Users/alexanderkim/.yarn/bin:/Users/alexanderkim/.config/yarn/global/node_modules/.bin:/Users/alexanderkim/.nvm/versions/node/v15.14.0/bin:/Users/alexanderkim/bin:/opt/homebrew/bin:/usr/local/bin:/usr/local/sbin:/opt/homebrew/sbin:/Users/alexanderkim/.yarn/bin:/Users/alexanderkim/.config/yarn/global/node_modules/.bin:/Users/alexanderkim/.nvm/versions/node/v15.14.0/bin:/Users/alexanderkim/bin:/opt/homebrew/bin:/usr/local/bin:/usr/local/sbin:/usr/bin:/bin:/usr/sbin:/sbin:/Users/alexanderkim/MobileDev/flutter/bin:/Users/alexanderkim/MobileDev/flutter/bin:/Users/alexanderkim/MobileDev/flutter/bin
what kind of fallbacks? It is before /usr/local/bin, so it's considered as first or not? I'm confused.
Then it should be picked up (although it's possible that your browser sees a different $PATH, if it's being modified by your .bashrc / .zshrc / etc). What behavior do you see?
It is modified in .zshrc. It shows this error:
Error: Unable to fetch and parse login fields: Error: {"status":"error","code":22,"version":3000007,"params":{"action":"fetch","error":"Unable to detect the location of the gpg binary to use","message":"Unable to detect the location of the gpg binary"}}
.zshrc is only read by terminal... I don't have Mac but quick googling tells me you should modify PATH in /etc/launchd.conf for browsers to be able to see this - could you please try?
https://www.bounga.org/tips/2020/04/07/instructs-mac-os-gui-apps-about-path-environment-variable/
But why it worked when a brew was in /usr/local dir?
Either because /usr/local/bin is one of the folders that is in $PATH that GUI apps can see, or because when gpg is not found anywhere in $PATH, we fallback to some common *nix locations:
https://github.com/browserpass/browserpass-native/blob/0997aee14a849b02b84beb60c321de5bb5a0cf99/request/fetch.go#L132-L133
/opt/homebrew sounds quite custom so I'm not sure yet if it should be added to a default list. It's hard to judge for me, a Linux user, if it's a misconfiguration on your end or every mac user will come to this issue. Let's see.
I think it would be a standard very soon, when more people would get m1. So, maybe you could add it as another fallback?
It feels a little weird to incorporate homebrew specific hacks into a cross-platform tool, that's why I'm a little hesitant 🤔
Curiously they even documented this hack in the FAQ:
https://github.com/Homebrew/brew/blob/master/docs/FAQ.md#my-mac-apps-dont-find-usrlocalbin-utilities
Have you considered to report an issue for homebrew? Why is their installation script not running this launchctl command automatically when you install homebrew?