Homebrew packages in PKG_CONFIG_PATH
Solution 1:
Convert the find
to a static list colon :
separated PKG_CONFIG_PATH list to reduce launch time.
Step 1. Run pkg-config --list-all
to determine what packages are already know by
pkg-config --list-all
# tidy tidy - tidy - HTML syntax checker
# tesseract tesseract - An OCR Engine
# …
Step 2. Run find
to determine the pkgconfig
directories that contain *.pc files.
# long form `find`
find /usr/local/Cellar -name 'pkgconfig' -type d | grep lib/pkgconfig | tr '\n' ':' | sed s/.$//
# short form `find`
find / -name "pkgconfig" -print
# /usr/local/Cellar/abc/0.1.5/lib/pkgconfig:…/usr/local/Cellar/xyz/2.6/lib/pkgconfig
Step 3. Add the paths libraries of interest, that are not already discoverable by pkg-config
, to PKG_CONFIG_PATH.
Option: use a /usr/local/Cellar/…
path which will need to be updated with each version number change.
export PKG_CONFIG_PATH=/usr/local/Cellar/abc/0.1.5/lib/pkgconfig
export PKG_CONFIG_PATH=$PKG_CONFIG_PATH:/usr/local/Cellar/abc/0.1.5/lib/pkgconfig
export PKG_CONFIG_PATH=$PKG_CONFIG_PATH:/my/build/from/source/mmmm/0.1.5/lib/pkgconfig
Options: When the Cellar is linked (typical) into /usr/local/opt/…
then a version independent path can be found and used.
sudo find / -name "uvw" -print
# /usr/local/Cellar/uvw
# /usr/local/opt/uvw
ls -l /usr/local/opt/uvw
# /usr/local/opt/uvw@ -> ../Cellar/uvw/4.2_1
Set these:
export PKG_CONFIG_PATH=/usr/local/opt/uvw/share/pkgconfig
export PKG_CONFIG_PATH=$PKG_CONFIG_PATH:/usr/local/opt/xyz/lib/pkgconfig