Brew doctor get warning on opencv

homebrewopen source

i'm new to mac os x. i read that homebrew is a good packet manager and i have tried it.

i have also read that to install opencv 2.4 i have to follow those steps:

  • install cmake via homebrew
  • download opencv
  • cmake, sudo make

and i have done it. now i have fully python wrapper in my mac os x. but now if i write brew doctor i have those warnings:

brew doctor
Warning: /usr/local/lib/pkgconfig isn't writable.
This can happen if you "sudo make install" software that isn't managed
by Homebrew.

If a brew tries to write a .pc file to this directory, the install will
fail during the link step.

You should probably `chown` /usr/local/lib/pkgconfig
Warning: Unbrewed dylibs were found in /usr/local/lib.
If you didn't put them there on purpose they could cause problems when
building Homebrew formulae, and may need to be deleted.

Unexpected dylibs:
    /usr/local/lib/libopencv_calib3d.2.4.2.dylib
    /usr/local/lib/libopencv_contrib.2.4.2.dylib
    /usr/local/lib/libopencv_core.2.4.2.dylib
    /usr/local/lib/libopencv_features2d.2.4.2.dylib
    /usr/local/lib/libopencv_flann.2.4.2.dylib
    /usr/local/lib/libopencv_gpu.2.4.2.dylib
    /usr/local/lib/libopencv_highgui.2.4.2.dylib
    /usr/local/lib/libopencv_imgproc.2.4.2.dylib
    /usr/local/lib/libopencv_legacy.2.4.2.dylib
    /usr/local/lib/libopencv_ml.2.4.2.dylib
    /usr/local/lib/libopencv_nonfree.2.4.2.dylib
    /usr/local/lib/libopencv_objdetect.2.4.2.dylib
    /usr/local/lib/libopencv_photo.2.4.2.dylib
    /usr/local/lib/libopencv_stitching.2.4.2.dylib
    /usr/local/lib/libopencv_ts.2.4.2.dylib
    /usr/local/lib/libopencv_video.2.4.2.dylib
    /usr/local/lib/libopencv_videostab.2.4.2.dylib
Warning: Unbrewed .pc files were found in /usr/local/lib/pkgconfig.
If you didn't put them there on purpose they could cause problems when
building Homebrew formulae, and may need to be deleted.

Unexpected .pc files:
    /usr/local/lib

/pkgconfig/opencv.pc
Warning: You have unlinked kegs in your Cellar
Leaving kegs unlinked can lead to build-trouble and cause brews that depend on
those kegs to fail to run properly once built. Run `brew link` on these:

    git

why?? what's wrong? what to do?

Best Answer

Homebrew's doctor command is very helpful. Since you installed OpenCV from source into the same directories that Homebrew is using, it's complaining about the unexpected files.

To solve the problem, just follow the instructions carefully. Homebrew tells you exactly what you need to do:

  • Make the /usr/local/lib/pkgconfig directory writable.
  • Delete the offending .dylib (/usr/local/lib/libopencv_*.dylib) and .pc files (/usr/local/lib/pkgconfig/opencv.pc).
  • Run brew link git. (Not directly related to OpenCV.)