Skip to content

Instantly share code, notes, and snippets.

@fiddlemath
Created August 8, 2022 23:16
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 fiddlemath/050cf42608bb01db1504934296d0a688 to your computer and use it in GitHub Desktop.
Save fiddlemath/050cf42608bb01db1504934296d0a688 to your computer and use it in GitHub Desktop.
#!/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