Created
August 8, 2022 23:16
-
-
Save fiddlemath/050cf42608bb01db1504934296d0a688 to your computer and use it in GitHub Desktop.
This file contains 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 -eoux pipefail | |
# Very very roughly, list a Mac's installed applications and their versions | |
# Output is nearly a valid CSV file, you might need to tweak it a little | |
for infile in /Applications/*/Contents/Info.plist ; do | |
name=$(plutil -extract CFBundleName raw "${infile}") | |
if [[ "$name" =~ .*"Could not extract value".* ]]; then | |
name=${infile#/Applications/} | |
name=${name%/Contents/Info.plist} | |
fi | |
version=$(plutil -extract CFBundleShortVersionString raw "${infile}") | |
if [[ "$version" =~ .*"Could not extract value".* ]]; then | |
version=$(plutil -extract CFBundleVersion raw "${infile}") | |
fi | |
echo "${name},${version}" | |
done | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment