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.

.MobileBackups.trash DELETION

Does anyone know the exact terminal command to delete .MobileBackups.trash from a macbook on mavericks. I have disabled local backups via terminal but the .MobileBackups.trash folder just won't go away. Using Daisy Disk, I can see that the folder is 20 GB. I have even filled my computer up with files so that there is only 2GB left on my SSD and the .MobileBackups.trash folder will still not delete automatically like it should. Would really appreciate some help!

MacBook Pro (Retina, Mid 2012), OS X Mavericks (10.9.1)

Posted on Jan 5, 2014 12:37 AM

Reply
Question marked as Top-ranking reply

Posted on Jan 5, 2014 12:40 AM

sudo rm -rf /path/to/file


Be careful with this command.

18 replies

Mar 11, 2016 9:41 AM in response to DMK73

I've taken DMK73's script a little further. You will need to edit at the top tmdir to be the directory to your Time Machine backup. When run, this will make sure that directory exists first then will do the same modifications. I've added the -v flag to the chflags command so it shows what files are being modified. All output is written to a file in /tmp and then at the end it displays the output without any of the "no such file or directory" messages.



#!/bin/bash


# This script fixes an issue with the /.MobileBackups.trash folder that is created by CrashPlan

# Most of the script comes from this thread: https://discussions.apple.com/thread/5750388?start=15&tstart=0


tm_dir="/Volumes/Time Machine/Backups.backupdb/mikes-macbookpro"

tmpout="/tmp/fix_MobileBackupsTrash.tmp"


if [ ! -d "$tm_dir" ]

then

echo "Time Machine directory is not found! Fix the script"

exit 1

fi


cd "$tm_dir"


echo > $tmpout 2>&1

echo "----------------------------------------" >> $tmpout 2>&1

echo "Starting on $(date)" >> $tmpout 2>&1

echo "----------------------------------------" >> $tmpout 2>&1

echo >> $tmpout 2>&1


# Unlock all local expired backup copies of CrashPlan


[ -f /.MobileBackups.trash ] && sudo find /.MobileBackups.trash -flags +schg -exec chflags -fv noschg {} \; >> $tmpout 2>&1


# Unlock all backup copies of CrashPlan

# Need to run from Time Machine machine directory (e.g. /Volumes/MyExternalHD/Backups.backupdb/MyMac/)

find . -maxdepth 1 -type d -exec sudo /System/Library/Extensions/TMSafetyNet.kext/Contents/Helpers/bypass chflags -fv noschg "{}"/Macintosh\ HD/Applications/CrashPlan.app \; >> $tmpout 2>&1


# Unlock CrashPlan application

sudo chflags -fv noschg /Applications/CrashPlan.app >> $tmpout 2>&1

# Or exclude CrashPlan from backups

#sudo tmutil addexclusion /Applications/CrashPlan.app >> $tmpout 2>&1


echo >> $tmpout 2>&1

echo "-----------------------------------------" >> $tmpout 2>&1

echo "Completed on $(date)" >> $tmpout 2>&1

echo "-----------------------------------------" >> $tmpout 2>&1

echo >> $tmpout 2>&1


grep -v "CrashPlan.app: No such file or directory" $tmpout

May 6, 2016 9:18 AM in response to nbar

Thanks for the info.


I needed to run this for a somewhat related problem--running a Time Machine backup that then would be used to restore to a new SSD with 1/2 the capacity of the original. When running the command though, I was hit with similar errors, due to permissions issues (I assume the system still had locked some of the files). So, I stopped the process, and went through a few restarts.


After this, checking both in Finder and Disk Utility indicated that the trashed Mobile Backups had indeed been deleted.


Not sure on this (maybe someone can enlighten), but I have a feeling, the trashed Mobile Backups are locked this way as a protective measure, in anticipation of drastic user errors, to give a last-ditch option of recovery.


I know it can be frustrating (I had to do quite a bit of searching to find this info), but often it looks like multiple restarts are the most trouble-free way to deal with this.

.MobileBackups.trash DELETION

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