ChatGPT解决这个技术问题 Extra ChatGPT

Understand homebrew and keg-only dependencies

I've recently started using homebrew, and I'm a bit confused as to what happens when I brew something onto my system, but its brewed dependencies are keg-only, meaning that they are linked under /usr/local.

For example, I'm install vips (an image processing library). One of its many dependencies is pixman. Pixman is installed as keg-only because apparently Mac OSX (Snow Leopard in this case) already ships with it (or a version of it).

Does this mean that vips will use the system version of pixman? If so, aren't there potential versioning issues related to using the system version rather than the dependency version (assuming they are different)?


B
Bonifacio2

For a software to be "keg-only" means it is installed in /usr/local/Cellar but not linked into places like /usr/local/bin, /usr/local/lib, etc. That means other software that depends on it has to be compiled with specific instructions to use the files in /usr/local/Cellar. That's done automatically by brew install when a formula specifies keg-only dependencies.

Formulas that specify keg-only dependencies make sure that the equivalent system libraries are not used. Your installation of vips is linked against a specific version of pixman in /usr/local/Cellar/pixman/<version>, so it isn't affected by the system version of pixman or any other Homebrew versions of pixman you might install.


Good explanation! You can often check with otool -L /usr/local/Cellar/vips/???/lib/*.dylib to see against which other libs it links.
I have an openssl 1.0.2s installed by homebrew and my mac os has LibreSSL 2.6.5 When I do openssl version, it always shows the one from os (LibreSSL) but when I run my python in interactive mode, it is actually using openssl. Can you help me understand how python picked up the correct openssl? @echristopherson
@Alex Like echristopherson said: It is linked against a specific version of openssl (during installation). Have a look at the python Brew Formula; there you can see that the path (brew's prefix) of the openssl@1.1 formula is used as arg, which in turn is used for configure.