MacOS – How to find MinimumOSVersion of all purchased iOS apps in iTunes

applicationsipaitunesmacos

I have many purchased iOS apps in my iTunes on macOS. I have an iPhone 4 with iOS 7.1.2 that cannot be upgraded to any upper iOS due to lack of compatibility. Some of apps in iTunes were downloaded in my iPhone 4 and then transferred to iTunes, these apps are compatible with my iPhone 4; But other apps were downloaded directly in iTunes need minimum version of iOS greater than 7.1.2. I want to find these incompatible apps with my iPhone 4.

A naive solution is to sync all apps with my iPhone 4 and look in error message that will list incompatible apps. Is there any fast solution to find all of those apps to remove them?

Best Answer

I changed Walt Stoneburner's script that I used to answer here to list MimimumOSVersion of apps located in iTunes library. Run This script in terminal:

for f in ~/Music/iTunes/iTunes\ Media/Mobile\ Applications/*.ipa; do
    (echo "$f" ; unzip -Z1 "$f" | egrep -i ".app/Info.plist$" | \
        awk '{ print length($0) " " $0; }' | sort -n | cut -d ' ' -f 2- | head -n1 | \
        xargs -I file unzip -p "$f" file  | \
        plutil -p - | egrep -i "\"MinimumOSVersion\"" ) | \
        perl -e 'while (<>) { if (m!^/!) { chop; $fqn=$_; } if (m/"(.+)" => (".+")/) { $e{lc($1)}=$2; } } print "\"${fqn}\",$e{\"minimumosversion\"}\n";'; \
done

It will list apps like this:

"/Users/username/Music/iTunes/iTunes Media/Mobile Applications/app1.ipa","7.0"
"/Users/username/Music/iTunes/iTunes Media/Mobile Applications/app1.ipa","8.0"
"/Users/username/Music/iTunes/iTunes Media/Mobile Applications/app3.ipa","7.1"
...

If you want the output in a file you can save the script in a file (minimum.sh for example) then run this command in the terminal:

$ sh minimum.sh > output.csv

Then open output.csv with Apple Numbers and sort the table with second column. Minimum iOS versions required are now observable.