List iTunes Apps by Purchaser

I finally developed a way to list all your iTune applications by Purchaser, and even better, I can do it from the command line.

Last year I was helping a friend who has pretty poor internet connectivity upgrade his iPad to the latest version of iOS. To do this, I connected his iPad to my system, performed a backup in iTunes, then synchronized to update the operating system. This had the side effect of beaming some of his applications to my iTunes, which in order to continue, he authenticated against. His iPad updated great, and he was on his way.

Things on my machine seemed okay for a while, that was until some of the apps he purchased that I didn’t have wanted to update. Not having his password, I wasn’t able to update them, but even worse, Apple wasn’t announcing which apps needed updating with his account so I could simply delete them as I wanted to.

Instead, for over a year, I was greeted in iTunes by a numerical indicator saying I needed up update my apps, but when I went to do it, I was up to date. Every once in a while I’d recognize an app that I didn’t purchase (in a haystack of nearly 1,000 iPhone apps) and delete it. Only then did the number drop, but later rise again when some other app needed updating.

What I needed to do was list out all the apps by Purchaser.

One of things that really annoys me about Apple is that stuff that is trivial to implement, like putting an optional Purchaser column in iTunes, they don’t do. The feature is half heartedly there, though. Press Command-I for Info, and you can see the purchaser for an item.

Only now you have to click and inspect your whole app list. And with the number of applications I own, this doesn’t scale well at all.

Searching the web reveals that others are in a similar bind, and that Apple seems to really care less about the few handful of users with this problem. Like much on the Apple Support Site, it’s unhelpfully silent.

Frustrated, I decided to solve this problem once and for all.  Open Terminal and cut’n’paste the following in:

for f in ~/Music/iTunes/iTunes\ Media/Mobile\ Applications/*.ipa; \
 do (echo "$f" ; unzip -p "$f" "iTunesMetadata.plist" | \
 plutil -p - | egrep -i "\\"(itemName|artistName|AppleID)\\"" ) | \
 perl -e 'while (<>) { if (m!^/!) { chop; $fqn=$_; } if (m/"(.+)" => (".+")/) { $e{lc($1)}=$2; } } print "\\"${fqn}\\",$e{\\"itemname\\"},$e{\\"artistname\\"},$e{\\"appleid\\"}\n";'; \
done

7 thoughts on “List iTunes Apps by Purchaser”

  1. I am sorry but I want to know what to do after copy pasting the script in Terminal Windows. I mean the Terminal window runs the script and shows the apps and apple ID etc in the terminal window itself but in very scrambled form. Is this what supposed to happen or it has to show that in iTunes somehow like a Purchaser Column in iTunes. I am new to script so maybe be it’s very basic question but hope you can help.

    Thanks.

    1. The purpose of the script is to do nothing more than print out a line for each app in iTunes, four fields per line, each surrounded in double quotes. It’s the fully qualified filename of the app file, the name of the app, the publisher, and the user id that installed it.

      This does not modify iTunes, it doesn’t add any columns, or anything like that. It’s a passive display of information in a format that’s easy for other programs and filters to digest. In my case, piping the output through grep with a -v option allowed me to see only the list that didn’t have my email address.

      $ ...that big huge script... | grep -v '[email protected]'

      To that end, I was able to manually go into iTunes and remove the things giving me trouble. Admittedly, the script’s intended audience is for bash users to do similar processing.

  2. Thanks very much for figuring this out, this has helped me a bunch! To anyone not familiar with working with scripts in a Terminal, a quick tip: add this to the end of the line (after “done”):

    >~/Desktop/apps_by_purchaser.csv

    This takes all the output and puts it in a file. This file can be imported into your favorite spreadsheet program, such as Numbers or Google Spreadsheets. This makes it easy to search and sort the data as much as you like.

    Thanks again!

  3. In latest version of OSX 10.11 the location of *.ipa has changed so I had to modify the script to:

    for f in ~/Music/iTunes/Mobile\ Applications/*.ipa; \
    do (echo “$f” ; unzip -p “$f” “iTunesMetadata.plist” | \
    plutil -p – | egrep -i “\\”(itemName|artistName|AppleID)\\”” ) | \
    perl -e ‘while () { if (m!^/!) { chop; $fqn=$_; } if (m/”(.+)” => (“.+”)/) { $e{lc($1)}=$2; } } print “\\”${fqn}\\”,$e{\\”itemname\\”},$e{\\”artistname\\”},$e{\\”appleid\\”}\n”;’; \
    done

  4. Thank you for this! Almost 5 years later and it just saved me a lot of time trying to figure out which apps on my iphone kept prompting me to login in to itunes store with a old id. Thanks again.

Leave a Reply

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.