Skip to content

Instantly share code, notes, and snippets.

@mdeboer
Created November 17, 2020 15:34
Show Gist options
  • Save mdeboer/32fab11698106d5aee203bda829d6677 to your computer and use it in GitHub Desktop.
Save mdeboer/32fab11698106d5aee203bda829d6677 to your computer and use it in GitHub Desktop.
Homebrew pkg-config paths
#!/bin/bash
#
# Echoes export statements for all pkgconfig paths of homebrew packages.
# You can echo the output directly to a file and source that.
#
# Usage:
# homebrew_pkgconfig.sh > .homebrew_pkgconfig && source ~/.homebrew_pkgconfig
#
homebrew_paths=$(find /usr/local/opt/*/lib -type d -name "pkgconfig")
first=true
for path in $homebrew_paths; do
if $first; then
printf 'export PKG_CONFIG_PATH=%s\n' "$path"
first=false
continue
fi
printf 'export PKG_CONFIG_PATH=$PKG_CONFIG_PATH:%s\n' "$path"
done
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment