Created
February 9, 2014 08:11
-
-
Save drkibitz/8896013 to your computer and use it in GitHub Desktop.
Recursively list paths of shared libraries required by given binary. Usage: `otool-ls-r /bin/bash`
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
list="" | |
otool_list() { | |
local lib="$1" | |
local libs="" | |
if [[ "$list" == "${list/:$lib/}" ]]; then | |
echo "$lib" | |
list="$list:$lib" | |
libs=$(otool -L "$lib" | sed -n 's/^ \(.*\) (compatibility version.*$/\1/p') | |
for lib in $libs | |
do | |
otool_list "$lib" | |
done | |
fi | |
} | |
otool_list "$@" |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Thanks for sharing this. It didn't work for me, but this did: