How to clean up and reclaim space from a large folder in Messages on macOS?
Hi all,
if you ever had or currently have the problems of finding the folder
/Users/<username>/Library/Containers/com.apple.MobileSMS/Data
filled with GBs or even TBs of data here is a solution which might help you. Not sure if this is the only solution, or one Apple would recommend, but I post about it here anyway.
Recently I run a storage analysis for my main macOS disk and found the folder ~/Library/Containers filled with GBs of temporary data. In addition to some folders assigned to various applications I saw that the folder
/Users/<username>/Library/Containers/com.apple.MobileSMS/Data
was really very full. I saw a subdirectory tmp in which macOS or Messages had stored temporary versions of files in iCloud, attachments, etc.
Looking for a solution on the internet how to clean this up and reclaim the space was not really successful. Reboot did not work, stopping and restarting the Messages app neither, ...
As I did not want to simply delete the folder tmp I tried this workflow which seems to work successfully:
- Start Messages app
- Go to Settings -> iMessage, and do 'Sign Out' for your Apple Account (I did not switch off the 'Enable Messages in iCloud' option).
- Close the Messages app
- Open a Finder window and go to folder /Users/<username>/Library/Containers/com.apple.MobileSMS/Data (You could also open a terminal and go there using the cd command).
- Move the tmp folder to the Trash (always good to keep it there until the end of the workflow, just in case a 'Put Back' is needed. One never knows ...)
- Restart the Messages app. In my case, the tmp folder was recreated but stayed empty.
- Go back to Settings -> iMessage in the Messages app and log on to your Apple account
That's it. All my messages appeared again (coming from iCloud).
At the end I made a test to see where the content in that tmp folder comes from. I created a test iMessage to myself and attached a 300MB file, using the Blender installation dmg file which I had downloaded the day before.
I was surprised to see the dmg file showing up twice (!) in the tmp folder structure although the message in Messages was not delivered successfully:
As you can see above, the file shows up in a folder 'LinkedFiles' and 'Media'. One can imagine that sending many messages in the App over time, with attachments or links to files, can fill up that tmp folder quite fast. But the files do seem to stay there forever. I expected a temporary folder called tmp to hold files which are deleted again when the app is not used but the content seems to stay there even when doing a reboot.
Anyway, the procedure described above worked for me. After going through the steps the Messages app was working as it should be, all my messages were still there, and the folder /Users/<username>/Library/Containers/com.apple.MobileSMS/Data had a much smaller size.
Problem solved.
Maybe someone from Apple can comment here how this tmp folder for the Messages App in the Containers structure does work, and what the best/official/compliant way is to keep it at a small size.
Best regards
Roland
[Re-Titled by Moderator]
Mac mini