7

Macs with Apple Silicon chips (M1/M2/etc.) can install iOS apps from the App Store.

When an iOS app is uninstalled, its metadata is not deleted, and is reused if the app is reinstalled. This makes it impossible to have a fresh install. I am testing apps with TestFlight and it's very annoying.

Is there a way to clear application data for an iOS app installed on macOS?

0

3 Answers 3

10

Quoting from the Apple Developer documentation on Configuring the macOS App Sandbox

The first time the user launches your sandboxed app, the system creates its container — a folder in ~/Library/Containers that your app has exclusive read-write access to.

This is the location on the file system that macOS uses to store user-specific data for sandboxed apps.

To locate and delete the data files associated with an iOS app installed on macOS (e.g., via the App Store), follow the steps below:

  1. Determine the installed app's bundle identifier:

    Open Terminal.app and run the following command-line to retrieve the bundle identifier of the installed iOS app:

    defaults read /Applications/<app_name>.app/Wrapper/iTunesMetadata.plist softwareVersionBundleId
    

    Replace <app_name> with the name of the app as it appears in the /Applications directory. You can find it by navigating to /Applications directory in Finder or Terminal.

    For e.g., install X (formerly Twitter) app from the App Store using this link: https://apps.apple.com/app/x/id333903271

    The app will appear as X.app in /Applications directory.

    Now running the command-line:

    defaults read /Applications/X.app/Wrapper/iTunesMetadata.plist softwareVersionBundleId
    

    will output the bundle identifier as:

    com.atebits.Tweetie2
    
  2. Uninstall the app:

    Delete the app either through Launchpad or by removing the app bundle from the /Applications directory. You can also remove the app using the command-line:

    rm -rf /Applications/X.app
    
  3. Navigate to the Containers Directory ~/Library/Containers/:

    Navigate to the directory by running the command-line:

    cd ~/Library/Containers/
    
  4. Search for the app's Container using its bundle identifier:

    Search for the app’s bundle identifier to find its container directory by running the command-line:

    find . -iname "<bundle_identifier>"
    

    For example, in this case, run the command-line:

    find . -iname "com.atebits.Tweetie2"
    

    The find command will print the path for matching Container. In this case, the output will be shown as below (the Container ID may differ):

    ./ABE705EF-93F7-43C4-9966-443465F6942D/Data/Library/Application Scripts/com.atebits.Tweetie2
    ./ABE705EF-93F7-43C4-9966-443465F6942D/Data/Library/HTTPStorages/com.atebits.Tweetie2
    ./ABE705EF-93F7-43C4-9966-443465F6942D/Data/Library/Caches/com.crashlytics.data/com.atebits.Tweetie2
    ./ABE705EF-93F7-43C4-9966-443465F6942D/Data/Library/Caches/com.atebits.Tweetie2
    
  5. Delete the app's Container:

    Delete the top-level Container directory (the one starting with the UUID), by running the command-line:

    rm -rf <container_id>
    

    For e.g. in the above case, run the command-line:

    rm -rm ./ABE705EF-93F7-43C4-9966-443465F6942D
    
  6. (Optional) Delete Group Containers:

    Some apps may create a Group Container. To check for the presence of a Group Container, navigate to the directory: ~/Library/Group Containers/:

    cd ~/Library/Group Containers/
    

    perform a search using the same find command:

    find . -iname "<bundle_identifier>"
    

    then delete the corresponding group container folder (if any found):

    rm -rf <container_id>
    
  7. (Optional) Delete Preferences and Caches:

    Navigate to the following directories one-by-one:

    cd ~/Library/Preferences/
    

    and

    cd ~/Library/Caches/
    

    search for the bundle identifier using the same find command and get rid of any matching files.

  8. (Optionally) Restart your Mac:

    Restarting the Mac ensures all the related caches are fully flushed.

  9. Check for TestFlight App Data:

    For apps installed via TestFlight, its data may reside under: ~/Library/Developer directory.

    Search and delete any containers or folders related to the bundle identifier here if the above steps didn’t remove all data.

0
4

As pointed out in the comment of @Redarm, deleting an App Store app via Launchpad is supposed by some to delete its sandbox as well, just as it does on an iPhone or iPad. I tried this once and it didn’t work, but maybe it does sometimes for reasons I’m not aware of. I can’t find any official documentation on this point.

There is an easy way to find the opaquely-named sandbox created by a mobile app, if the app is still installed. Launch the app, then launch Activity Monitor and search for it by name. Double-click the table entry to open the inspector window, then select the Open Files and Ports tab. In there you may find one or more files under /Users/<you>/Library/Containers, although some apps don't have a sandbox and don't create any files.

2

Since it looks like Launchpad is going the way of the dodo and, judging by Linc Davis' answer, wasn't reliably getting rid of a sandbox container, there is another option:
App Store
Within one's account the purchased applications show an ellipsis button (3 dots) once the pointer hovers over it. When clicked, this reveals the option to "Delete App...". Removed this way it also deletes the corresponding container(s).

1
  • I tried this and found lots of leftovers unfortunately: /private/var/db/receipts/org…bom /private/var/db/receipts/org…plist /private/var/db/receipts/org…plist /private/var/folders/wn/pzgqb…C/org… /private/var/folders/wn/pzgqb0lx4n70fnv6g5fcfnc80000gp/C/org… ~/Library/Application Scripts/org… Commented Jul 17, 2025 at 11:37

You must log in to answer this question.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.