Skip to content

Instantly share code, notes, and snippets.

@VincentSit
Created August 25, 2021 10:23
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save VincentSit/a5ac735ca3d072b739c5ec5158900337 to your computer and use it in GitHub Desktop.
Save VincentSit/a5ac735ca3d072b739c5ec5158900337 to your computer and use it in GitHub Desktop.
Generate PKG_CONFIG_PATH from HomeBrew
#!/bin/bash
for package in $(brew list)
do
# path=$(brew --cellar $package)
path="/usr/local/Cellar/$package"
# only the first match.
pkgdir=$(find $path -mindepth 1 -type d -name "pkgconfig" -print -quit 2> /dev/null)
if [[ "$pkgdir" && -d "$pkgdir" ]]
then
PKG_CONFIG_PATH="$pkgdir:$PKG_CONFIG_PATH"
fi
done
echo $PKG_CONFIG_PATH
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment