148

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)?

Dave Liepmann
  • 1,555
  • 1
  • 18
  • 22
cgat
  • 3,689
  • 4
  • 24
  • 38

1 Answers1

240

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.

Bonifacio2
  • 3,405
  • 6
  • 34
  • 54
echristopherson
  • 6,974
  • 2
  • 21
  • 31
  • 12
    Good explanation! You can often check with `otool -L /usr/local/Cellar/vips/???/lib/*.dylib` to see against which other libs it links. – Samuel John Jun 12 '13 at 12:40
  • 1
    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 Apr 29 '20 at 22:58
  • 1
    @Alex Like echristopherson said: It _is linked against a specific version_ of `openssl` (during installation). Have a look at the [`python` Brew Formula](https://github.com/Homebrew/homebrew-core/blob/62f3caff8338c1eced8c64884292bf1183b33fd8/Formula/python.rb#L74); 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`. – einjohn May 23 '20 at 06:55