<html><body style="word-wrap: break-word; -webkit-nbsp-mode: space; -webkit-line-break: after-white-space;" class="">Hi,<div class=""><br class=""></div><div class="">currently (and as I can tell also in the past, see [1],[2],[3],[4],[5]),<font face="Menlo" class=""> brew —prefix <FORMULA> </font>is really slow (see the example output below), which makes it somewhat annoying using pass on macOS. I hunted this down and found that the problem is the following:<font face="Menlo" class=""> brew </font>runs <font face="Menlo" class="">git rev-parse --short=4 --verify -q HEAD</font> every time to find the currently installed version of the formula (which seems somewhat unreasonable). Depending on your<font face="Menlo" class=""> git </font>and network connectivity, this may take longer. Using<font face="Menlo" class=""> brew —prefix </font>without a formula is reasonably fast. As far as I can tell, there is currently no way to change the prefix path in brew, thus using<font face="Menlo" class=""> $(brew —prefix)/opt/gnu-getopt </font>should be a save way for determining the path to<font face="Menlo" class=""> gnu-getopt</font>.</div><div class=""><br class=""></div><div class="">I patched this and attached the patch to this mail. Since my implementation is somewhat longer, I think it should not be implemented in one line anymore, but split it up as I did (see the patch). If you come up with something better let me know (or, of course, patch it yourself). Additionally, since I am not using Macports, I can not test if this also works with<font face="Menlo" class=""> ports</font>. Before considering pushing my patch upstream, someone needs to test this! For<font face="Menlo" class=""> brew</font>, it works fine.</div><div class=""><br class=""></div><div class="">Thank you for reading this and best regards,</div><div class="">Artur</div><div class=""><br class=""></div><div class=""><br class=""></div><div class="">Appendix:</div><div class=""><br class=""></div><div class=""><br class=""></div><div class="">Brew time measurement:</div><div class=""><br class=""></div><div class=""><div class=""><font face="Menlo" class="">$ time brew --prefix gnu-getopt</font></div><div class=""><font face="Menlo" class="">/usr/local/opt/gnu-getopt</font></div><div class=""><font face="Menlo" class="">        1.31 real         0.80 user         0.41 sys</font></div></div><div class=""><br class=""></div><div class=""><br class=""></div><div class="">References:</div><div class=""><br class=""></div><div class="">[1]: <a href="https://github.com/Homebrew/brew/issues/4947" class="">https://github.com/Homebrew/brew/issues/4947</a></div>[2]: <a href="https://github.com/Homebrew/brew/issues/3327" class="">https://github.com/Homebrew/brew/issues/3327</a><div class=""><div class="">[3]: <a href="https://github.com/Homebrew/brew/issues/3097" class="">https://github.com/Homebrew/brew/issues/3097</a></div>[4]: <a href="https://github.com/Homebrew/brew/issues/2938" class="">https://github.com/Homebrew/brew/issues/2938</a></div><div class=""><div class="">[5]: <a href="https://github.com/Homebrew/brew/issues/4153" class="">https://github.com/Homebrew/brew/issues/4153</a></div><div class=""><br class=""></div><div class=""><br class=""></div></div><div class="">Patch:</div><div class=""><br class=""></div><div class=""><div class=""><font face="Menlo" class="">diff --git a/src/platform/darwin.sh b/src/platform/darwin.sh</font></div><div class=""><font face="Menlo" class="">index 342ecce..04d8ef3 100644</font></div><div class=""><font face="Menlo" class="">--- a/src/platform/darwin.sh</font></div><div class=""><font face="Menlo" class="">+++ b/src/platform/darwin.sh</font></div><div class=""><font face="Menlo" class="">@@ -43,6 +43,14 @@ qrcode() {</font></div><div class=""><font face="Menlo" class="">        fi</font></div><div class=""><font face="Menlo" class=""> }</font></div><div class=""><font face="Menlo" class=""><br class=""></font></div><div class=""><font face="Menlo" class="">-GETOPT="$(brew --prefix gnu-getopt 2>/dev/null || { which port &>/dev/null && echo /opt/local; } || echo /usr/local)/bin/getopt"</font></div><div class=""><font face="Menlo" class="">+if [[ $(command -v brew) ]]; then</font></div><div class=""><font face="Menlo" class="">+       GETOPT="$(brew --prefix)/opt/gnu-getopt"</font></div><div class=""><font face="Menlo" class="">+elif [[ $(command -v port) ]]; then</font></div><div class=""><font face="Menlo" class="">+       GETOPT="{ which port &>/dev/null && echo /opt/local; }"</font></div><div class=""><font face="Menlo" class="">+else</font></div><div class=""><font face="Menlo" class="">+       GETOPT="echo /usr/local"</font></div><div class=""><font face="Menlo" class="">+fi</font></div><div class=""><font face="Menlo" class="">+GETOPT="$GETOPT/bin/getopt"</font></div><div class=""><font face="Menlo" class="">+</font></div><div class=""><font face="Menlo" class=""> SHRED="srm -f -z"</font></div><div class=""><font face="Menlo" class=""> BASE64="openssl base64"</font></div></div></body></html>