A sample text widget

Etiam pulvinar consectetur dolor sed malesuada. Ut convallis euismod dolor nec pretium. Nunc ut tristique massa.

Nam sodales mi vitae dolor ullamcorper et vulputate enim accumsan. Morbi orci magna, tincidunt vitae molestie nec, molestie at mi. Nulla nulla lorem, suscipit in posuere in, interdum non magna.

Extract metadata from Apple IPA files

The resources and code for Apple iDevice Apps are all contained in a single .ipa file.
I needed to find out who was the Apple account that purchased a particular Apple store app.
This information is stored inside the ipa file in a plist file.
[However this code could be the basis for extracting any meta info from the ipa file]

The way I did it was with the following shell script.


#unzip the meta file inside the ipa to the tmp directory
unzip -q "$1" iTunesMetadata.plist -d /tmp/

#chmod the meta file (as sometimes its not readable)
chmod 777 /tmp/iTunesMetadata.plist

#run the defaults command to extract the data and grep it for some keys
a=`defaults read /tmp/iTunesMetadata | grep -i AppleID | grep -o '".*"'`
b=`defaults read /tmp/iTunesMetadata | grep -i itemName | grep -o '".*"'`

#display the data tab separated - AppleID, Product Name, Filename
echo -e "$a \t $b \t $1"

#clean up any temp file
rm -f /tmp/iTunesMetadata.plist

I called the script ‘owner’, and running it against any ipa file which is in located in “~/Music/iTunes/iTunes Media/Mobile Applications” eg.

owner "Angry Birds 1.4.2 1.ipa"

Will display:

"steve@apple.com" "Angry Birds HD" Angry Birds 1.4.2 1.ipa

The important bits are

  • You can unzip an ipa file, just as you would a zip file
  • The file iTunesMetadata.plist contains the meta information about the ipa
  • the command ‘defaults’ parses the plist binary file, into name value pairs.

My code then simply grep’s for whatever info you want from this file
you could of course run it against all files in the dir with something like

find . -name '*ipa' -exec owner {} \;

If this has been useful to you, and you would like to buy me a coffee, or help towards my monthly server costs please click here to make a donation via paypal.

3 comments to Extract metadata from Apple IPA files

  • Dave G

    I have 2 (different iTunes username) accounts on my iMac & iPhone. An old username and a newer username. I bought many “purchase” app’s under the “old” user name. I don’t want the OLD username any more. Is it possible to change the “purchased by:” name from the old username to the new username modifying your “script” and have iTunes recognize it as mine? I purchased these app’s from Apple so there is nothing “illegal” or stealing going on. And if so how!!! thanks, DaveG

  • I found your blog web site on google and verify quite a few of your early posts. Proceed to keep up the very good operate. I merely further up your RSS feed to my MSN News Reader. Searching for ahead to finding out extra from you afterward!…

  • Jes

    I very much appreciate the info; thanks for writing it. Inspired, I visited man defaults
    The function of grep in those two lines is available directly from defaults:

    a=`defaults read /tmp/iTunesMetadata AppleID`
    b=`defaults read /tmp/iTunesMetadata itemName`

    Thanks again

Leave a Reply

You can use these HTML tags

<a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <s> <strike> <strong>