24

There are some folders in ~/Library/Mobile Documents/ (like XXXXXX~com~companyname~appname) which seems to be left by apps I already removed from all my devices. However, if I delete those folders, they restored back almost immediately. They are not visible in Finder or in iCloud management in System Preferences. How to get rid of them?

  • 1
    When I deleted some of mine, the iCloud Drive folder under Finder Favorites also seemed to be stuck forever syncing, through multiple reboots, until I reinstalled those apps and let them fix those folders. I would definitely like to know how to get rid of them. –  Nov 08 '16 at 20:29
  • Have you tried signing into icloud.com, clicking the iCloud Drive button, and deleting them from the web interface? – toxefa Feb 17 '17 at 19:20
  • @py4on iCloud Drive for web doesn't show those folders. Actually it shows only ~/Library/Mobile Documents/com~apple~CloudDocs/ and some folders from apps I using, like Automator, Pixelmator, Pages, etc... But there is a bunch of folders created by apps I already removed, and those folders are invisible everywhere except of Terminal ls -a command. – iMisanthrope Mar 02 '17 at 13:27
  • System Preferences/iCloud/Manage is the official way to do this, but you will find folders for every app you have ever installed. I'm not aware of a correct way of removing them all. If you use the command line cd ~/Library/Mobile\ Documents; du -sk * | sort -rn you will see most of those directories are largely empty. You can always create a new Apple ID and start from scratch :-) – MichaelR Oct 18 '17 at 00:46
  • This Ask Different question might be related to this one: https://apple.stackexchange.com/q/180990/122152 – intagli Feb 29 '20 at 16:39
  • I wasn't able to delete the folder but its contents (both locally and on iCloud) via finder using the open folder command in terminal. – Roberto Jul 27 '20 at 07:16
  • Sonoma 14.0 - this is a nightmare. I have folders that won't sync, won't delete (rm -rf and they just come right back). They don't show up in Settings > iCloud > Manage Storage or on web. The dystopia has arrived—we are no longer in control of our own machines. – luckman212 Sep 30 '23 at 19:22

4 Answers4

2

Those should be the same apps listed under System Settings/iCloud/Manage... (button down right next to the bar), so you can delete them there.

Dikti
  • 192
2

Apps that utilise iCloud storage create containers where application data is stored. When an App is uninstalled, an uninstall routine is called which allows the App to clear up local and remote files, however not every developer implements this.

The following method has worked for all but one of my App containers. I have raised the issue with Apple.

Fix iCloud persistence

  1. Re-install the App or Apps in question
  2. Open Settings App
  3. Tap your name at the top to open iCloud Settings
  4. Tap "iCloud"
  5. Under "Apps Using iCloud" click "Show All"
  6. Switch "Off" the App or Apps in question
  7. Click the back arrow to return to "iCloud"
  8. Click "Manage Account Storage"
  9. Find the App or Apps in the list, select and click "Delete Documents and Data..."

Clean up leftover artifacts

  • Clear CloudDocs of folders referring to deleted Apps
  1. Open your Terminal of choice and enter the following command: cd ~/"Library/Application Support/CloudDocs/session/containers"
  2. List all files and folders in the directory by using the command ls -a
  3. Delete any and all files or folders referring to Apps that have since been deleted on your iOS or MacOS devices (ensure the App has been deleted). Use the following command to delete from the command line: rm -rf iCloud.com.publisher.appname

enter image description here

  • Delete iCloud App Library
  1. In a Terminal, enter the following command: cd ~/"Library/Mobile Documents/com~apple~CloudDocs"
  2. Enter the command cd ../ to go up one level
  3. List all files and folders in the directory by using the command ls -a
  • You will now see the 'Documents' data for each App that has data stored in iCloud, simply deleting artifacts from this director is not enough! The bird daemon will re-download from iCloud.
  1. Open one of the target artifacts using the following command: open iCloud~com~reddit~reddit

enter image description here

  1. Right click on the folder name in Finder breadcrumbs and click "Copy as Pathname"

enter image description here

  1. Go back to Terminal and enter the following command: rm -R PATHNAME (enter the pathname you copied where specified)
  2. Enter the following command: cd ~/"Library/Mobile Documents/com~apple~CloudDocs"
  3. Enter the command cd ../ to go up one level
  4. List all files and folders in the directory by using the command ls -a
  5. Now remove the artifact using the rm -R ARTIFACTNAME command

Ideally, Apps should 'clean up' after themselves during deletion which would avoid this process.

If the App does not appear in "Manage Account Storage" despite being re-installed, cd into the iCloud~com~publisher~appname directory, and cd into the Documents folder within that directory. From there, create some dummy files, such as touch index.html. Reload "Manage Account Storage" and the App will appear, ready for deletion.

felpsey
  • 21
  • 3
  • "Removing the artifact" does not remove the artifact. Just tried this and bird just replaces it. – John Aug 06 '23 at 22:56
  • Admittedly this has worked for 5 out of 6 of my artifacts. Try a few more times, ensuring you're deleting the 'content' from iCloud in Settings. I raised this with Apple a while ago, yet to receive a response. – felpsey Aug 07 '23 at 09:49
-2

You cannot do that, this is how iCloud works.

These folders are how iCloud is designed to work, so you can stop using iCloud or forget about your intentions for a 'clean system'; sorry for saying this but you are not using a Linux flavor.

So, iCloud is not designed to allow you to micromanage it. The folders will be empty if you have no data in that application. [Upadate] This method isn’t working

elulcao
  • 270
-4

Have you tried a 3rd party app like 'App Cleaner'? it removes files that are left behind when you just delete an app. It may work in your case.

Natsfan
  • 14,185