# Python script to analyze the iMazing library

**URL:** <https://talk.tidbits.com/t/python-script-to-analyze-the-imazing-library/30655>\
**Category:** TidBITS Talk\
**Created:** [March 31, 2025, 11:47pm UTC](https://talk.tidbits.com/t/python-script-to-analyze-the-imazing-library/30655 "2025-03-31T23:47:05Z")\
**Posts on this page:** 13\
**Page:** 1

<div class="post-metadata">

**Author:** ![mschmitt](https://talk.tidbits.com/letter_avatar_proxy/v4/letter/m/9de0a6/32.png) [@mschmitt](https://talk.tidbits.com/u/mschmitt)\
**Post date:** [March 31, 2025, 11:47pm UTC](https://talk.tidbits.com/t/python-script-to-analyze-the-imazing-library/30655/1 "2025-03-31T23:47:05Z")

</div>

> [@AppBITS: Hyperspace Reclaims Space Used by Identical Files](https://talk.tidbits.com/t/appbits-hyperspace-reclaims-space-used-by-identical-files/30559/9):
>
> There’s also just badly designed apps. For example, iMazing downloads .PNG files for each app icon, and saves them separately for _every version_ of the application. It never purges them! So I only have 261 apps in the iMazing library, but there are 17,359 icon files. It appears that most of them are exact duplicates.

This is off topic but…

If anyone is interested, I’ve created a Python script that analyzes the iMazing App Library:

- Matches downloaded .ipa files to the app in the library
- Prints a table of the app name, version, and the .ipa name. Note that in iMazing, the .ipa names are cryptic. How would you know that “com.yourcompany.TestWithCustomTabs-1.ipa” is actually AccuWeather 20.0.14?
- Identifies orphan .ipa files, i.e. files that are not actually in the library
- Purges the Apps/Icons folder of old, unnecessary icons. It keeps all the icons for apps in your library and in your App Store account.

---

<div class="post-metadata">

**Author:** ![blm](https://talk.tidbits.com/letter_avatar_proxy/v4/letter/b/3ec8ea/32.png) [@blm](https://talk.tidbits.com/u/blm)\
**Post date:** [April 1, 2025, 2:02am UTC](https://talk.tidbits.com/t/python-script-to-analyze-the-imazing-library/30655/2 "2025-04-01T02:02:18Z")

</div>

I’d be interested. Maybe put it up on github or something?

---

<div class="post-metadata">

**Author:** ![mschmitt](https://talk.tidbits.com/letter_avatar_proxy/v4/letter/m/9de0a6/32.png) [@mschmitt](https://talk.tidbits.com/u/mschmitt)\
**Post date:** [April 1, 2025, 11:17pm UTC](https://talk.tidbits.com/t/python-script-to-analyze-the-imazing-library/30655/4 "2025-04-01T23:17:38Z")

</div>

As mentioned above, I created a Python script for analyzing the iMazing App Library and purge icons. Version 1.1 of the script may be copied from [here](https://topaz.github.io/paste/#XQAAAQDWEgAAAAAAAAARiEJHiiMzw3cPM/1Vl+2nx/DqKkM2yi+Ar0XzbQ9Fece+Wr4hzu8U3QAFejLXfhBY3rCoPJIAtFqEa9R4ZM9l7GTqB88fkIFqosQt6tB9nb3XZbqPdfuoDC1xRAYNT6GhmjPhveUh4AWAEyjnRZgQAoPmm2EEC//mvjGCqmb8JHLpsII61p662hmw961GqmAGdnZ3AIv5wqwE8GtPJUNxvQimBDv1AFn1REMnrdiRi4Y+bUZy8qhs3NdMf1wvjY/xwNuc+gag4Mt4VgQgTVZV0Uvc/XI2H650zqe7HcdtbvEMU41e5laaPs4KLGvouH4xvlWn1X5PKOib5cFzIOks5ret7DX17oj1y9KL7SxZUW74lk8nTIBI5jCZWyYSBrDH4cIzgDxol0mosEWa56hYTwyncWwdE5gJ73Uo1M2jNTVRHM5UbiuOLoTKF5/BBLcVcoOpL8l2Nkb6Wa2C1zPozwBDPZ5OJPzlDfi+im0QHp6Fu6TDZOaDAI0pLX9haI1hDI9Zv1fdvfzgzqKfwakDHIeaxjpoNKx5+hh3O5bphZ63LjQYlvA5lXAck0xTNqzX49q2cWzBPu9nwtMtR1uGetW7/caVtgxW4wB1zkzeZ0dtUYhMO1zZGMwcc1lEitarWcHFX91WWUYRzHpIAF18fusS6cgdxlPod2ddOah5QjeZgvZkIZkGoFBNKrOTAGzsdsMBzdVMDUXolVBNpI9rXoyinJfvDuaZYrUxdZRgKBVwi+zOIhxqUh8CWHRBKrTtzcAp2Ei9bZEOqAuK0kUSYDB3Tw1NtkQfDsN3wQtzsV7OkbO9F+S6TVwoVkCUKRLNf3fk4qxTvXaiT5Z1S8/+dLko9n1X/ta8tnVru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2ZeIZwk+Y6MZexipDf96dYKf+/3QUnhhe2vOG6bWUaBkUFrYpnvAb0hMb+H4IJt6vwBD/TApjw2O9Zwi8FJrnpvPdPfo+TwIyjTwJnVBf9kCFho9GHJoK/2/PN4=).\[1\]

Soon to be Frequently Asked Questions:

**Q:** What is the iMazing App Library?  
**A:** [iMazing](https://imazing.com) is a product for interfacing with iDevices. One of its features is app management, where you can do the kinds of things you used to be able to do in iTunes. Such as, download the .ipa files for apps and install them.

The iMazing App Library is like the iTunes App Library of downloaded apps, _plus_ it shows apps that you can download because they were previously purchased. That is, they’re in your App Store account.

**Q.** Where does iMazing store the App Library?  
**A.** The default location is `~/Library/Application Support/iMazing/Library`, but the user may have set iMazing to use a different location. The script will use whatever location is the current setting in iMazing.

**Q.** What’s in the App Library?  
**A.** At the root is a file Apps.plist, which is the database that tracks all of the apps in the library.

There’s an Apps subfolder that contains all the downloaded .ipa files. Under this folder is an Icons folder with thousands of icon files.

**Q:** Why create this script?  
**A:** Two reasons. The first is that sometimes the downloaded .ipa files get out of synch with what iMazing _thinks_ it has downloaded. (This used to happen quite often, but now it happens rarely). When this happens, it is very difficult to figure out which .ipa files are the orphans, because the .ipa file name can be wildly different than the app name.

The second reason is purging of the Icons folder. iMazing stores one or two icon files for every version of every app that was downloaded or is (or was!) in your App Store account. It doesn’t appear that it ever removes these icon files, even when the app version they are for is long gone.

**Q:** How does the script work?  
**A:** The script matches up the .ipa files to their associated entries in the Apps.plist, and then displays the app name, version, and .ipa file.

It will tell you if the number of .ipa files doesn’t match the Library, and tell you which .ipa files are orphans.

For purging of icons, it keeps the icons for any downloaded .ipa files, and the icons for the most recent version in the App Store.

It will not run the icon purge if there’s a mismatch between the number of .ipa files and the number of downloads registered in the Apps.plist. You must resolve the discrepancy first.

**Q:** What version of Python does this require?  
**A:** I tested it with Python 3.9.6, which is the Python that comes with macOS Ventura. It will probably work with newer Python versions, and maybe some older ones.

**Q:** What if I don’t want to purge icons?  
**A:** Comment out the last line in the script?

**Q:** What? Why isn’t that a parm to the script?  
**A:** I developed it using Visual Studio Code, where it is harder to pass in parms, and I was too lazy to add the parm parsing code. (There’s a neat way to do this in Python, though!)

**Q:** How do I run it?  
**A:** Open a terminal window, enter python3 _path to script_

**Q:** What is the recommended steps for running it, with icon purging?  
**A:** I’d advise:

1. Open iMazing and inspect the App Library. Check if any apps are missing their icon; if so then it won’t be my fault that the icon is still gone after the purge!
2. Close iMazing
3. Duplicate the Icons folder just in case
4. Run the script
5. Open iMazing and re-check the icons. Are any missing now, that weren’t before? That would be a bug.
6. If everything’s fine then you can delete the Icons folder backup.

**Q:** When I got to step 5, it immediately downloaded more icons. Doesn’t that mean the purge was too aggressive?  
**A.** It appears that iMazing downloads icons for every app version that it knows about (i.e. are registered in the Apps.plist), even if that version isn’t downloaded nor could it be from the App Store. So it may download a couple hundred icons that were just purged. But it still will be thousands less than it had before.

On my machine, I had 17,538 icon files. The script purged 16,925, keeping 613. Opening iMazing downloaded 223, so the final total was 836.

**Q:** Is there a bug bounty?  
**A:** Yes. I will award 836 free Internet points for each bug.

**Q:** Are you a Python programmer? This script seems {impressive _or_ poorly coded}.  
**A:** Not in my real job, except for very recently. For personal use, I started coding [Advent of Code](https://adventofcode.com) in Python in 2021; previously I was using REXX.

**Q:** Did you use AI to code it?  
**A:** I am using Google Gemini Code Assist for code completion; the free GitHub Copilot has a small number of completions per month. But it didn’t write the code for me.

* * *

1. This is not actually an uploaded file! The entire contents of the file is compressed into the URL. Which means, you’re guaranteed that what you get hasn’t been modified. To change it would require a new URL.

---

<div class="post-metadata">

**Author:** ![Will\_B](https://talk.tidbits.com/user_avatar/talk.tidbits.com/will_b/32/18200_2.png) [@Will\_B](https://talk.tidbits.com/u/Will_B)\
**Post date:** [April 2, 2025, 12:56am UTC](https://talk.tidbits.com/t/python-script-to-analyze-the-imazing-library/30655/5 "2025-04-02T00:56:32Z")

</div>

> [@mschmitt](#):
>
> previously I was using REXX

Once upon a time, I had a lot of fun with REXX (ARexx) specifically.

Thanks!

---

<div class="post-metadata">

**Author:** ![Will\_M](https://talk.tidbits.com/letter_avatar_proxy/v4/letter/w/a698b9/32.png) [@Will\_M](https://talk.tidbits.com/u/Will_M)\
**Post date:** [April 2, 2025, 8:09pm UTC](https://talk.tidbits.com/t/python-script-to-analyze-the-imazing-library/30655/6 "2025-04-02T20:09:13Z")

</div>

Thanks. I like how you encoded the script in the URL. I hadn’t known that was possible (but I hadn’t thought about it).

> [@mschmitt](#):
>
> **Q.** Where does iMazing store the App Library?  
> **A.** ~/Library/Application Support/iMazing/Library

If I have changed the default location, do I simply substitute the path to the new Library? (In case it matters, my iMazing Library is on a removable disk.)

---

<div class="post-metadata">

**Author:** ![mschmitt](https://talk.tidbits.com/letter_avatar_proxy/v4/letter/m/9de0a6/32.png) [@mschmitt](https://talk.tidbits.com/u/mschmitt)\
**Post date:** [April 2, 2025, 8:19pm UTC](https://talk.tidbits.com/t/python-script-to-analyze-the-imazing-library/30655/7 "2025-04-02T20:19:28Z")

</div>

> [@Will\_M](#):
>
> If I have changed the default location, do I simply substitute the path to the new Library?

Yes. Current script has it coded in two places, so you’ll have to change both. What I should have done is set a variable to the iMazing/Library folder, then used that to derive the location of the plist and Apps subfolders.

Maybe I can figure out how iMazing finds the Library when it is not in the default place, then it would work automatically.

**Update** : I changed the download URL to be for version 1.1 of the script, which now finds the current iMazing library automatically.

---

<div class="post-metadata">

**Author:** ![mschmitt](https://talk.tidbits.com/letter_avatar_proxy/v4/letter/m/9de0a6/32.png) [@mschmitt](https://talk.tidbits.com/u/mschmitt)\
**Post date:** [April 2, 2025, 8:22pm UTC](https://talk.tidbits.com/t/python-script-to-analyze-the-imazing-library/30655/8 "2025-04-02T20:22:16Z")

</div>

> [@Will\_M](#):
>
> I like how you encoded the script in the URL.

It is [Topaz’s Paste](https://github.com/topaz/paste): a “no-database, client-side paste service. It turns text into LZMA-compressed, Base64-encoded URLs”.

This service is used by Advent of Code for users posting their solutions to Reddit. Topaz is the mastermind behind AoC.

---

<div class="post-metadata">

**Author:** ![BrianW](https://talk.tidbits.com/letter_avatar_proxy/v4/letter/b/b2d939/32.png) [@BrianW](https://talk.tidbits.com/u/BrianW)\
**Post date:** [April 2, 2025, 8:37pm UTC](https://talk.tidbits.com/t/python-script-to-analyze-the-imazing-library/30655/9 "2025-04-02T20:37:21Z")

</div>

Didn’t the iMazing developer comment here a year or so ago when there was a thread about their new licensing model?

---

<div class="post-metadata">

**Author:** ![Will\_M](https://talk.tidbits.com/letter_avatar_proxy/v4/letter/w/a698b9/32.png) [@Will\_M](https://talk.tidbits.com/u/Will_M)\
**Post date:** [April 2, 2025, 9:43pm UTC](https://talk.tidbits.com/t/python-script-to-analyze-the-imazing-library/30655/10 "2025-04-02T21:43:42Z")

</div>

> [@mschmitt](#):
>
> the plist and Apps subfolders

Hmm. I have an “Apps” folder, an “iMazing.Apps” folder, and an “iMazing Versions/Apps” folder. Each of them has many .ipa files.

You mention “Apps subfolders” (plural); are you referring to all these, but with only the Apps folder coded in the script?

---

<div class="post-metadata">

**Author:** ![mschmitt](https://talk.tidbits.com/letter_avatar_proxy/v4/letter/m/9de0a6/32.png) [@mschmitt](https://talk.tidbits.com/u/mschmitt)\
**Post date:** [April 2, 2025, 10:11pm UTC](https://talk.tidbits.com/t/python-script-to-analyze-the-imazing-library/30655/11 "2025-04-02T22:11:40Z")

</div>

I was referring to the Apps folder under the Library folder. On my machine it is at `~/Library/Application Support/iMazing/Library/Apps`. This is the folder which, on my machine, contains all of the downloaded .ipa files.

I’m wondering how you have more than one folder with .ipa files, and which one is actually in use. And does each have an Apps.plist file in the parent folder?

I have…

```auto
iMazing (folder)
   Library (folder)
      Apps.plist
      Apps (folder)
          lots of .ipa files
          Icons (folder)
              lots of .png files

```

For what it’s worth, I started with iMazing 2, which created that folder structure. I upgraded to iMazing 3, and it kept exactly the same files. I never attempted to use both versions simultaneously.

**Update:** I think iMazing may only have one library at a time, which for iMazing 3 is set in iMazing \> Preferences \> Library \> Default library location.

I changed the script so it finds that setting and uses it. So, if I have this right, wherever the user’s current Library is, that’s what will be analyzed.

---

<div class="post-metadata">

**Author:** ![Will\_M](https://talk.tidbits.com/letter_avatar_proxy/v4/letter/w/a698b9/32.png) [@Will\_M](https://talk.tidbits.com/u/Will_M)\
**Post date:** [April 3, 2025, 4:29pm UTC](https://talk.tidbits.com/t/python-script-to-analyze-the-imazing-library/30655/12 "2025-04-03T16:29:22Z")

</div>

> [@mschmitt](#):
>
> I was referring to the Apps folder under the Library folder. On my machine it is at `~/Library/Application Support/iMazing/Library/Apps`. This is the folder which, on my machine, contains all of the downloaded .ipa files.

Yes, I was referring to the Library folder, which for me is on an external SSD. The iMazing Library folder (including subfolders) contains downloaded .ipa files.

> [@mschmitt](#):
>
> I’m wondering how you have more than one folder with .ipa files, and which one is actually in use. And does each have an Apps.plist file in the parent folder?

I, too, wonder about the multiple folders. Until you started this thread, I hadn’t paid attention to what was in the iMazing Library. Here it is.

 ![Screenshot 2025-04-03 at 10.52.28](https://talk.tidbits.com/uploads/default/original/3X/0/8/088b0dec4350fdc330c2c110cae7c816e628219a.png)  
You can see there is only one Apps.plist file (plus a backup). However, the folders iMazing.Apps and iMazing.Versions/Apps were last modified last July, and the Apps folder was modified a few days ago, which I think answers the question of which one is in use. I wonder what would happen if I moved all the .ipa files into the Apps folder.

> [@mschmitt](#):
>
> I changed the script so it finds that setting and uses it.

Sweet. I’ll grab the new script. And since iMazing is currently unable to download .ipa files, I might take this opportunity to start a new Library folder.

Here’s another oddity: ‘~/Library/Application Support/iMazing/Library/Apps/Icons’ contains many .png files with a modification date that matches the Apps folder in my iMazing Library. (It does not contain nearly as many .png files as Apps/Icons in my iMazing Library, but why would iMazing be storing .png files in two different places?) One more thing. There are three .ipa files in Apps/Icons in my iMazing Library. All-in-all, it makes me think iMazing is rather sloppily programmed.

---

<div class="post-metadata">

**Author:** ![nextstep](https://talk.tidbits.com/user_avatar/talk.tidbits.com/nextstep/32/12787_2.png) [@nextstep](https://talk.tidbits.com/u/nextstep)\
**Post date:** [April 3, 2025, 6:46pm UTC](https://talk.tidbits.com/t/python-script-to-analyze-the-imazing-library/30655/13 "2025-04-03T18:46:19Z")

</div>

If I simply delete that Icons folder, won’t iMazing simply rebuild it?

---

<div class="post-metadata">

**Author:** ![mschmitt](https://talk.tidbits.com/letter_avatar_proxy/v4/letter/m/9de0a6/32.png) [@mschmitt](https://talk.tidbits.com/u/mschmitt)\
**Post date:** [April 3, 2025, 6:58pm UTC](https://talk.tidbits.com/t/python-script-to-analyze-the-imazing-library/30655/14 "2025-04-03T18:58:51Z")

</div>

It will try, but some of the icons may no longer be available to download.

You can make a backup of Icons and try it and see if that’s the case for you.
