Mac OSX Recovery Mode Terminal: rm -rf doesn’t delete anything

deletingrecoveryterminal

I have a seemingly broken MacBook Air that doesn't boot, but I can get into the recovery console. If I try to reinstall Mac OSX on the main disk (Macintosh HD aka /dev/disk1s2), the installer complains that there isn't enough disk space available.

So I opened up a terminal and tried to manually delete unnecessary files.

Using rm -rf, it looks like everything works, except that the disk space isn't freed. On reboot, the files are there again as if nothing happened.

  • Folders I 'delete' with rm -rf seem to vanish from the directory listinng (ls)
  • df -h never updates the amount of free space after rm
  • Rebooting into recovery console shows the deleted files are there again

And when I look at the disk in Disk Utility in the recovery console, it tells me that there are 4 GB of free space, but 0 KB deletable.

How can I delete the missing files without reformatting the whole HD and losing all data?

And why doesn't rm -rf work?

Using rm without -f (e.g. # rm -r /Volumes/Macintosh\ HD/Developer) first asks me to confirm each file deletion, then errors with

no such file or directory.

Which I would assume is a permissions issue. But I'm root (#) in the terminal and the files are owned by root/wheel. As suggested, I tried to remount with write permissions (mount -uw). This did not give me an error message, but the behavior is still the same (files reappear on reboot).

Best Answer

Using -f hides errors. Try running the command without the f option: rm -r ….

Without the actual error message, I can guess what the problem is: you're trying to delete files by providing a path you expect to the files but do not match the actual path.

When you're booted into Recovery, the Recovery environment is mounted at /, so paths like /Users are actually pointing to the Recovery HD. For example, instead of

rm -rf /Users/…

you should prepend to your paths the correct path to the volume

rm -rf /Volumes/Macintosh\ HD/Users/…

where Macintosh HD is your startup disk volume. Try ls /Volumes to see what's available.