You can make a difference in the Apple Support Community!

When you sign up with your Apple Account, you can provide valuable feedback to other community members by upvoting helpful replies and User Tips.

Looks like no one’s replied in a while. To start the conversation again, simply ask a new question.

Do I lose anything, and what do I lose, if I delete my ~/Library/Containers folder? (MacOS 10.14.6 Mojave)

Hi. Despite other support articles claiming "Containers" will usually get cleared on next restart, on my Mac (suffering from relatively small SSD that can't be removed/replaced) the folder takes well over 20GB.


Is it safe to remove? if not all of it, what CAN be safely removed from there?


the real hogs inside it are com.apple.cloudphotosd, com.apple.BKAgentService, com.apple.mail, com.apple.Safari, com.apple.Photos and com.apple.Notes



MacBook Pro 15", macOS 10.14

Posted on Mar 8, 2020 11:05 PM

Reply
Question marked as Top-ranking reply

Posted on Mar 9, 2020 8:00 AM

An app could possibly store something other than preferences in their sandbox (i.e. container). What you lose would be dependent on the app that created the sandbox. As Kurt Lang mentioned, they mostly contain preferences or other configuration data for the app. However, I don't think anything prevents an app from storing data there.


Also, as was first mentioned, if you are looking to recover storage space, you are looking at the wrong place. The app container contains hard links to data elsewhere on the computer. When you look at the space used, those hard links will report the space used by the linked file, not what it actually uses (virtually nothing).

11 replies
Question marked as Top-ranking reply

Mar 9, 2020 8:00 AM in response to Motti.Sh

An app could possibly store something other than preferences in their sandbox (i.e. container). What you lose would be dependent on the app that created the sandbox. As Kurt Lang mentioned, they mostly contain preferences or other configuration data for the app. However, I don't think anything prevents an app from storing data there.


Also, as was first mentioned, if you are looking to recover storage space, you are looking at the wrong place. The app container contains hard links to data elsewhere on the computer. When you look at the space used, those hard links will report the space used by the linked file, not what it actually uses (virtually nothing).

Mar 9, 2020 7:35 PM in response to Motti.Sh

Motti.Sh wrote:

my Mac (suffering from relatively small SSD ...



If the real question is how do I free up storage space on my mac—


==================================================================

How to free up storage space on your Mac - Apple Support

https://support.apple.com/en-us/HT206996


User tip: "Other and What Can I Do About It ?"

https://discussions.apple.com/docs/DOC-5142


Try something like OmniDiskSweeper for a GUI to get a good look at itemized file size and location:

OmniDiskSweeper http://www.omnigroup.com/more


others for example—

Disk Inventory X: http://www.derlien.com/ (takes forever to load up.)

Grand Perspective: http://grandperspectiv.sourceforge.net/


Or alternatively from the Terminal.app:


File size, and finding missing GB— list the items in the home folder with the sizes, including invisible items.

sudo du -h -d 1 ~/


File size, and finding missing GB —will list the items in root with the sizes, including invisible items.

sudo du -h -d 1 /





Mar 9, 2020 12:41 AM in response to Motti.Sh

If you are trying to free up space on your mac do not delete items from your System folder or any Library folders, these folders contain items that are essential to the smooth running of your mac and the apps you have.

If you are looking to free up space copy items from within your Users/<Home> folder to an external drive. Things you do not need on a daily basis, movies images, music take up a lot of space, after copying them over and verifying they have copied over successfully then delete them from your mac.

Mar 9, 2020 5:22 AM in response to Motti.Sh

What @Eau Rouge suggested is absolutely right. You should not remove the libraries and other system folders from your system.

If you do not pay heed to this, you may end up compromising the functioning of your system.

So ensure that you do not mess up your system.

You can buy an external drive and transfer the content that you don't need on a regular basis, to the external drive.

And then delete it from your mac.

That way you would be able to free up space on your mac for your endeavours.

Regards.

Mar 9, 2020 6:37 AM in response to Motti.Sh

Despite other support articles claiming "Containers" will usually get cleared on next restart…

I don't know where you're reading these (or possibly even Apple's own support articles), but they are wrong. This folder is never automatically emptied out.


Lots of apps, both those installed by the OS and third party, put data for themselves both there and in the Group Containers folders.


Many of the Apple items are defaults and will be rebuilt if you remove them. But basically, they're another form of preferences, though a bit more complex than just a .plist file so more data can be saved.

Mar 9, 2020 11:41 PM in response to Eau Rouge

While yours is a good general advice for Mac users, mine is a very specific question, relating to understanding the mechanism of "Containers" (i.e. sandboxes) and when/how they are used.


I do not intend to delete things before I know what that'll do. but I am greatly unsatisfied to find the SAME very photo assets in my Photos Library (~/Pictures/Photos Library/Masters) and within the 14GB com.apple.cloudphotosd container (/Users/motti/Library/Containers/com.apple.cloudphotosd/Data/Library/Application Support/com.apple.cloudphotosd/services/com.apple.photo.icloud.sharedstreams).


If these containers only serve as intermediate synchronization pads - And can be rebuilt by the OS - I need to know about it. If so, this is also lousy engineering in my opinion.


I would be thankful for more concrete answers, and maybe pointers to documentation if possible

Mar 9, 2020 11:48 PM in response to leroydouglas

Actually - this is NOT the question, and I am well aware of the plenty methods to free up storage on my tiny SSD. I also used both OmniDiskSweeper and grandPerspective for years, and I being a Mac software engineer since 1990, I'm well aware of how to find large files.


I am interested in the technical answer to my question. What (if) is lost when these sandbox 'containers' are deleted. Are they synched back from other devices (or iCloud), do they get rebuilt automatically from the local storage? What is the "price" of deleting them in terms of time-consuming processes, data loss, etc.



Mar 10, 2020 4:24 AM in response to Motti.Sh

I am greatly unsatisfied to find the SAME very photo assets in my Photos Library (~/Pictures/Photos Library/Masters) and within the 14GB com.apple.cloudphotosd container (/Users/motti/Library/Containers/com.apple.cloudphotosd/Data/Library/Application Support/com.apple.cloudphotosd/services/com.apple.photo.icloud.sharedstreams).

I already explained that. Please read about hard links.

There are not "copies" of those files. They all point to the same storage on disk.

Mar 10, 2020 4:40 AM in response to Barney-15E

Thank you very much for this enlightening note (about MacOS using Hard Links to files outside the Sand-Box containers.


Do you know by chance a way (maybe in terminal?) to tell such files (files that have more than one hard-link to) ? With that, I can write a tiny script to tell me how big are these "Containers" and "Group Containers" in reality - meaning, minus the "originals" (double quotes as with hard links there are no originals).


My thought to delete some of these containers was NOT after all aimed at gaining disk space (although that may be of great benefit, especially when I see containers that are 3 years old, and relate to apps no longer existing on my Mac) but the real thing is - I experience lots of buggy behavior in "Photos" cloud synchronization, and I was wondering if deleting its container would force it to do things better. Now if all those 15GB of assets in the container are just references to some originals within my Photo Library, then it is (more or less) safe to delete them (eh, the hard-links) and so force Photos refresh its synchronization state.

Mar 10, 2020 5:09 AM in response to Barney-15E

Well, I tried to assess the hard link theory, by attempting this in the terminal:

> find ~ -samefile ~/Library/Containers/com.apple.cloudphotosd/Data/Library/Application\ Support/com.apple.cloudphotosd/services/com.apple.photo.icloud.sharedstreams/assets/46BC82D0-51DE-4B0B-A0BA-36C11E7F6AEC/44530655-14F3-494E-8628-882AE9CD1A3E/P1160288.jpg

but unfortunately, it found none.

I repeated the test with many photos in the container, All which I clearly recognize from my Photos App library - but no hard links here I'm afraid.


What now?

Do I lose anything, and what do I lose, if I delete my ~/Library/Containers folder? (MacOS 10.14.6 Mojave)

Welcome to Apple Support Community
A forum where Apple customers help each other with their products. Get started with your Apple Account.