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 Best reply

Posted on Jan 5, 2014 12:40 AM

sudo rm -rf /path/to/file


Be careful with this command.

18 replies

Jan 5, 2014 12:51 AM in response to avi530

avis-mbp:~ avikahlon$ sudo rm -rf /.MobileBackups.trash

Password:

rm: /.MobileBackups.trash/Computer/2014-01-02-020314/Volume/Applications/CrashPlan. app: Operation not permitted

rm: /.MobileBackups.trash/Computer/2014-01-02-020314/Volume/Applications: Directory not empty

rm: /.MobileBackups.trash/Computer/2014-01-02-020314/Volume: Directory not empty

rm: /.MobileBackups.trash/Computer/2014-01-02-020314: Directory not empty

rm: /.MobileBackups.trash/Computer: Directory not empty

rm: /.MobileBackups.trash: Directory not empty



This is what I get when I execute this command

Jan 5, 2014 11:38 AM in response to Linc Davis

Well his advice was the only thing that worked for me. I have tried everything else and Mavericks just would not empty the mobile backups trash on its own. The 20GB that I saved really helped since i have a SSD. For the record I did not use the shell as a substitute for the trash. There was no other way to delete the files. I was not able to add the folder to the trash because it was a locked folder. I am extremely thankful for his "irresponsible, dangerous, and incompetent advice" as it was the only thing that fixed a problem I've had for a very long time.

Jan 5, 2014 2:57 PM in response to Linc Davis

So why don't u tell me how else I could have gotten rid of a locked folder that was supposed to delete automatically. I know plenty about computers and I know the risk of these commands. Also if you knew anything you would know that because I had a mobile backups.trash folder that I use time machine and wouldn't lose anything even if something went horribly wrong. (Which it didn't)

Sep 23, 2014 10:33 AM in response to avi530

I had the same issue with the CrashPlan.app folder located within the /.MobileBackups.trash after turning off local backups. I was not permitted to delete it. "rm -rf" on this directory did not work for me.


I had two problems because of this. My system log was full of errors regarding failure to delete the /.MobileBackups.trash directory. So if the operating system wanted to delete it and couldn't I figured something was wrong.


For a very long time there was no evidence of this problem except in the logs. Starting today it caused the icon in the menu bar to report failed time machine backups. The logs showed that the backup was successful but an immediate attempt to delete that trash file failed.


These two problems motivated me to take action.


I ran "ls -lO" and saw that the CrashPlan.app folder had the "schg" flag set. This sets the directory to "system immutable". Running "chflags noschg CrashPlan.app" removed this flag. I could then remove the folder with "rm -rf". I decided it was safe to remove this single folder since it related to an application specific file. Since the root level file "/.MobileBackups.trash" was a system directory I decided to leave it alone. I hoped that subsequent attempts by the OS would succeed.


I uninstalled CrashPlan and verified it was deleted from the Applications folder. I then triggered a time machine backup. The CrashPlan.app folder was reintroduced to the .MobileBackups folder. I got mad. I then decide to delete the trash folder. For me it's safe since I maintain two full clones of the boot volume on external drives.


After this the logs and time machine menu bar icon stopped showing the error.


Be very careful with the "rm -rf" command. It's so dangerous since you could delete a ton of stuff that could break your system. Make sure you understand the command.


As an aside, Linc Davis' comments were astonishing. They made me very uncomfortable and a bit afraid to post my experiences. I hope he doesn't respond to this post.

Oct 23, 2014 3:35 PM in response to bweinste

Put the following code in AppleScript Editor:


set cplocation to choose file with prompt "Choose the CrashPlan application you cannot delete"

try

do shell script "chflags nouchg \"" & POSIX path of cplocation & "\"" with administrator privileges

do shell script "chflags noschg \"" & POSIX path of cplocation & "\"" with administrator privileges

on error errmsg


display alert "ERROR!" messageerrmsg

tell me to quit

end try

display alert "Complete!" message "CrashPlan is now unlocked."

Oct 24, 2014 3:36 PM in response to bweinste

CrashPlan setting the "system immutable" (schg) flag caused the same problem for me too. I found a way to correct the problem which did not require manual deletion or messing around with the original /Applications/CrashPlan.app folder. I simply cleared the schg flag on all the instances of CrashPlan.app under /.Mobilebackups.trash where the schg flag had been set (see recipe below). On the next Time Machine backup, the /.Mobilebackups.trash folder got deleted automatically as it should, with no errors in the console log. No need to rm -rf anything.


To clear the schg flag on all files and folders under /.Mobilebackups.trash, enter the command below in the terminal (exactly as shown). This will work on anything that has the schg flag, not just CrashPlan:


sudo find /.MobileBackups.trash/ -flags +schg -exec chflags noschg {} \;


The "-flags +schg" part finds all files and folders under /.MobileBackups.trash with the schg flag set, while "-exec chflags noschg {} \;" executes the command "chflags noschg" on each of them, which clears the schg flag. This should be safe, since nothing in the .MobileBackups.trash folder should need to have the schg flag, and nothing other than CrashPlan.app did in my case.


The drawback with this approach is that the problem may reappear at some point, but it does not seem to happen very often, so you can repeat the recipe whenever the problem resurfaces. I suspect it happens when CrashPlan autoupdates itself and makes changes to the /Application/CrashPlan.app folder, though I have not had an opportunity to confirm that yet. Unsetting the schg flag on /Applications/CrashPlan.app might be a permanent fix, but could in theory be unsafe, and CrashPlan would probably just reactivate the flag on the next autoupdate anyway.

Feb 20, 2016 11:19 AM in response to korsbakken

I also found that the locked CrashPlan.app blocks Time Machine from pruning expired backups on external or network drives. I had to manually unlock the app folder in all snapshots for Time Machine 'post-backup thinning' to function as designed. Building on korsbakken's solution, here are all the steps that I have taken to resolve the issue with CrashPlan.

# Unlock all local expired backup copies of CrashPlan

sudo find /.MobileBackups.trash -flags +schg -exec chflags noschg {} \;


# 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 noschg "{}"/Macintosh\ HD/Applications/CrashPlan.app \;


# Unlock CrashPlan application

sudo chflags noschg /Applications/CrashPlan.app

# Or exclude CrashPlan from backups

sudo tmutil addexclusion /Applications/CrashPlan.app


Code42 (the developers of CrashPlan) told me that "CrashPlan is required to be run from the Application folder, so we lock it to prevent it from being moved".

.MobileBackups.trash DELETION

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