How to Remove or Delete old X11 Alias File from Trash
PROBLEM: Can't Delete "X11" Alias
After upgrading the Mac OS (presently Catalina), a 'Relocated Files' folder is created. And when you try to delete it one of its files /usr/X11 cannot be deleted with the errors 'mac os needs it' or 'no permission' or 'usr is in use', etc. because it is just an old Alias file but it points to your actual upgraded operating system X11 folder in another secure location.
SOLUTION: Delete using Bash Commands in Recovery Mode
• Restart Mac OS, holding COMMAND + R during the black screen from before any image appears and continuing to hold until the Recovery Menu appears,
• Select the language if asked,
• In the top Menu Bar, select Utilities, then in the dropdown menu select Terminal,
• Use the following Bash Commands to navigate the file directory until you are at the X11 file in the Trash (be sure to type what is within the "" exactly with spaces then pressing <enter> to execute it:
- type "ls" <enter> to list all files in the current directory,
- then type "cd .." <enter> to go up one level in the parent directory,
- repeat typing "ls" <enter>, then "cd .." <enter> until the list repeats. You have reached the topmost level.
- Now work your way down by typing "cd Volume" <enter> (if I'm not mistaken), then "ls" <enter> to check where you are and where to go next,
- Then "cd Sierra" <enter>, "ls" <enter>,
- "cd appleuser" (or whatever is your computer username) <enter>, "ls" <enter>,
- "cd .Trash" <enter>, "ls" <enter>,
- (in my case the item in my trash was a folder) "cd usr" <enter>, "ls" <enter>, and there I saw the pesky X11 file.
• You are now at the directory level to delete the file using the following Bash Command line:
- "rm X11" <enter>
- check that it's gone using the "ls" <enter> command line.
• Time to delete the containing folder while you're there:
- go up with "cd .." <enter>
- list the containing folder to be deleted with "ls" <enter>
- delete it also with "rm -r usr" <enter> (using -r because it is not a file but a folder).
- check your results with "ls" <enter> which should be empty.
Now reboot normally and you're done!
MacBook Pro 15″, macOS 10.15