Catalina Upgrade Cannot Delete Relocated Items

catalina

After upgrading to MacOS Catalina, I have a Relocated Items folder on my Desktop. Inside this folder is a PDF explaining what these items are.

Inside the folder are two sub-folders – Configuration and Security. These folders contain items that were in locations which are no longer compatible with the new macOS configuration. You are advised to review the items in these directories and take appropriate action.

The problem is that within the Security/usr folder is a symbolic link called X11 pointing to /opt/X11. The /opt/X11 directory does not exist and I cannot remove the X11 link with either unlink or rm (as sudo and have tried after sudo su to get a root shell). When I try to remove the file, I get "Operation not permitted". I can move the link to the Trash, but when I do, trying to empty Trash results in an error saying it cannot be emptied because X11 is a file required by macOS. So, how do I get rid of this link?

Update: I also noted that xattr shows nothing.

Best Answer

As this questi9on has had over 1k views, it seems it is a common issue. Therefore, I thought I would outline what I did to get it resolved in case others find it useful.

When I first tried to remove the link, I was told the operation was not permitted. Looking at the link, I could see it was owned by 'root' and in the 'wheel' group. I therefore then tried to remove it with sudo i.e.

sudo unlink X11

This failed with the same error. I also tried

sudo rm -rf X11

but this also failed with the same error. I then posted here asking for help and @Danijel-JamesW added a comment with a link to a useful article which provided some background on the new security features initially introduced in the previous version of macOS, but extended in Catalina. One of the things this article highlights is that some applications, like terminals and editors (in my case Emacs), need to have the full disk access privilege. Without this privilege, you will often get operation not permitted errors in unexpected locations/situations. Unfortunately, this was not the issue in my case. My terminal app (iTerm2.app) had the necessary permissions. However, the article did indicate that you could also get around the operation not permitted error by disabling SIP (System Integrity Protection). This was going to be my next move. However, in the end it was not necessary.

Thanks to a comment from @user3439694 I found out that you can boot into recovery mode and use the terminal to delete the file. THis is what I did

  1. Boot holding down commmand + R
  2. Click on Utilities and select Terminal from the top menu
  3. Enter rm -rf /path/to/file/to/remove
  4. Reboot

This solved my issue. One important thing to note is that working in the recovery terminal is powerful and potentially dangerous. You need to make sure you are deleting what you mean to delete. To be extra safe, instead of immediately issue the rm command, you can use ls -l to make sure you have the correct file or directory and then hit the up arrow to bring back the command from the history, move to the beginning of the line, remove the ls -l and type rm -rf, leaving the path unmodified following the rm -rf. Note also that the -r means recursive and -f means force - very powerful and dangerous. It will essentially remove everything from the point specified in the path downwards i.e. all sub directories and files. So, if you get that path wrong, you may end up deleting much more than you expected to. In my case, the path I needed was

/Volumes/Macintosh\ HD\ -\ Data/Users/tim/Desktop/Relocated\ Items

my login account is 'tim'. the '\ ' are needed to escape the spaces in the path. Most systems will have the path starting with /Volume, but the drive name may differ (i.e. Macintosh HD). the '- Data' is fairly standard.

Anyway, this fixed the issue and those irritating files are now gone and my Desktop folder is clean (for now!).