Backtracking and integrating

As one does brew installs, from time to time there are messages to add things to local .zshrc or bashrc, and other config files.

SUCH AS (below) – of course, these things fly by and one doesn’t always see them if mutiple installs are happening in sequence, they scroll off the window etc.

So, is there a simple way to go through all existing brew installs (I have about 150, so automation would be better), and work out which may need to add to PATH or similar? Ideally, of course it would be nice if that aspect was either separated and notified, or was an option to include in the install process…

If you need to have openssl@1.1 first in your PATH run:
echo ‘export PATH="/usr/local/opt/openssl@1.1/bin:$PATH"’ >> ~/.zshrc

For compilers to find openssl@1.1 you may need to set:
export LDFLAGS="-L/usr/local/opt/openssl@1.1/lib"
export CPPFLAGS="-I/usr/local/opt/openssl@1.1/include"

For pkg-config to find openssl@1.1 you may need to set:
export PKG_CONFIG_PATH="/usr/local/opt/openssl@1.1/lib/pkgconfig"

Since all such info is in the Caveats section of each formula, here’s a quick-n-dirty way to output this for all installed formulae (it requires jq):

brew info --installed --json | jq -r '.[] | select(.caveats | length > 0) | (.name, "----------", .caveats)'

brew install already consolidates, and prints out at the end of its run, the Caveats sections of all formulae being installed, so it’s not clear what could be added here.