Skip to content

Instantly share code, notes, and snippets.

@jayfallon
Created February 11, 2010 21:41
Show Gist options
  • Save jayfallon/301998 to your computer and use it in GitHub Desktop.
Save jayfallon/301998 to your computer and use it in GitHub Desktop.
#!/bin/bash
if test -z "$1"; then
echo "usage: $0 <libname>"
exit 1
fi
for file in `find /opt/local/lib -name *.dylib; find /opt/local/bin`; do
# Skip this match if it's a symbolic link
if test -f $file -a ! -L $file; then
# Look for references to the missing library
otool -L $file | grep --silent $1
if test "$?" = "0"; then
port provides `echo $file`
fi
fi
# Grab the name of the port and make sure to list each port just once
done | awk -F: ' { print $2 } ' | sort | uniq
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment