By Dan Moren
August 2, 2021 7:42 AM PT
Quick Tip: Delete that pesky un-deletable folder
You put something in the trash in macOS, you empty the trash, it’s gone. That’s how it’s supposed to work.
Sometimes, though, you run into an odd hiccup. Upon my recent updates to macOS Big Sur 11.5 and 11.5.1, I ended up with a folder called “Previously Relocated Items” on my Desktop. In it was another folder…inside that, another folder…and so on until it ended in what appeared to be an alias pointing towards a system folder elsewhere1. Fine, no problem. I tossed it in the trash and hit empty.
And that’s where I hit a snag.
The Finder graciously informed me that I could not empty the trash because the operation was not permitted. I tried restarting: no dice. Venturing into Terminal to delete the folder with the trusty
rm -rf command fared no better. I tried the
unlink option, which removes symbolic links (or symlinks, the command-line version of aliases), but that was similarly disallowed. Even superuser privileges conferred by
sudo made no difference.
So, what’s a user to do? I didn’t want to be stuck with that item in my Trash bin for the rest of my days (or until a subsequent update came along to iron things out), so I poked about a bit until I found some other folks who’d encountered the same issue, and located a solution.
That answer ended up being restarting my Mac in Recovery mode—by holding down command-R at boot—and launching the Terminal utility there to remove the offending file, which works because in Recovery the Terminal session is logged in as
A few caveats before you attempt this yourself: First, some suggested solutions said that in order to do this, you need to disable Apple’s System Integrity Protection (SIP), a security feature that prevents you from making certain low-level changes that could damage the operating system. This is not required, and I wouldn’t recommend turning off SIP—those protections are there for a reason.
Second, whenever you’re interacting with your machine as
root, be extra careful. That’s a lot of power to wield, and a simple typo can really mess your day up. Be sure you’re deleting only the files you mean to delete, and be as specific as possible. (For example, I first used
unlink to remove the problematic symlink, then removed folders one at a time, starting with the deepest and moving up.)
Finally, one issue I encountered was that—thanks to the recent changes of Apple’s file system—the new APFS protocol separates the system and your data into separate volumes. Before you can access your files via the Terminal in Recovery, you’ll need to first launch Disk Utility and mount the Data volume of your drive, which will in turn require you authenticate with your user password. Then you can use Terminal to navigate to the correct volume and remove the files.
Hopefully this helps folks who find themselves besieged by these undeleteable files. Maybe in a future update, Apple will work this issue out for itself.
- The X11 subsystem, if you’re curious. ↩
[Dan Moren is the East Coast Bureau Chief of Six Colors. You can find him on Twitter at @dmoren or reach him by email at email@example.com. His latest novel, The Aleph Extraction, is out now and available in fine book stores everywhere, so be sure to pick up a copy.]
If you appreciate articles like this one, support us by becoming a Six Colors subscriber. Subscribers get access to an exclusive podcast, members-only stories, and a special community.