Looks like no one’s replied in a while. To start the conversation again, simply ask a new question.

Desktop folder having my username cannot be deleted

In the process of setting up my new iMac, I had to run the Migration Assistant more than once. The upshot of this was a folder in "Deleted Users" having my username, which is "gws". There were other folders in Deleted Users having other user names, which I was able to delete. The folder-in-question's icon is faded whereas the other username folders which I easily deleted were normal.


I can move this folder to the trash, but emptying the trash pops the error message that it cannot be deleted because it's needed by the OS: "“uux” can’t be modified or deleted because it’s required by macOS". A similar message appears for the next directory in the folder when I click "skip" in the error dialog, and indeed for many many "skips" until I click "stop" to dispose of the message.



I pulled it back out and onto my desktop and have backed it up on an external drive.


I used "Get Info" to change the permissions to read & write for "everyone".


Here is how it looks in Terminal (this is in /Users/gws/Desktop):

drwxrwxr-x@ 12 root wheel 384 Mar 17. 13:35 gws


I noted that despite Get Info showing the permissions for "everyone" are read & write, the above file had no "w" in the 3rd permissions group. Using "sudo chmod 777 /Users/gws/Desktop/gws" did add the missing "'w", so the file then looked like:


drwxrwxrwx@   12 gws  staff        384 Mar 17 13:35 gws


This also failed with the same error dialog as described above.




My proper user directory is like this in Terminal (this of course is in /Users):

drwxr-xr-x@ 75 gws    staff  2400 Mar 19 16:24 gws




I have tried booting in Recovery mode and disabling CIP then restarting. Same failure to delete.


I tried changing my username in "Users & Groups" and also renaming the "/Users/gws" folder to match, then restarting and logging in with the new user name without problem, yet trying to delete the desktop "gws" folder again failed with the same message.


How can I get rid of the "gws" folder from my Desktop folder?


Thanks!


iMac Line (2012 and Later)

Posted on Mar 21, 2020 3:58 PM

Reply
Question marked as Best reply

Posted on Mar 23, 2020 12:57 PM

Solved! As "root" on the external drive, I checked the file attributes of the offending file and saw the "com.apple.macl" directory attribute didn't appear (don't know why; I hadn't done anything yet). I simply tried to delete (recursively) the directory and after a few minutes, the file was gone. I rebooted back on the internal drive and confirmed it was gone.


Here's what I did, step by step in case anyone else has my problem:


1) System preferences>startup disk, choose bootable external drive.

2) Restarted on the external drive

3) Logged in as me and enabled the "root" user

4) Logged out as me and logged in as "root"

5) Used Terminal to "cd" into the /Users/gws/Desktop folder on the internal drive, which is where the undeletable file was

6) Checked the extended attributes of the offending "gws" file and noticed the "com.apple.macl" attribute didn't appear

7) Issued rm -R gws (No warnings came up!)

8) Minutes passed while I used Activity Monitor to see the "rm" process running and waited (impatiently) for it to end

9) Issued "ls -l" to confirm the directory was gone

10) Logged out as "root"

11) Logged in as me and disabled the "root" user

12) Used System preferences as in step 1 to select the internal drive for restart

13) Restarted on the internal drive

14) Logged in as me and confirmed what I had seen as root: the file was gone


Thanks to everyone who reviewed this post, and special thanks to D.I Johnson and to leroydouglas for taking the time to try to help.

Similar questions

12 replies
Question marked as Best reply

Mar 23, 2020 12:57 PM in response to Gary Sears

Solved! As "root" on the external drive, I checked the file attributes of the offending file and saw the "com.apple.macl" directory attribute didn't appear (don't know why; I hadn't done anything yet). I simply tried to delete (recursively) the directory and after a few minutes, the file was gone. I rebooted back on the internal drive and confirmed it was gone.


Here's what I did, step by step in case anyone else has my problem:


1) System preferences>startup disk, choose bootable external drive.

2) Restarted on the external drive

3) Logged in as me and enabled the "root" user

4) Logged out as me and logged in as "root"

5) Used Terminal to "cd" into the /Users/gws/Desktop folder on the internal drive, which is where the undeletable file was

6) Checked the extended attributes of the offending "gws" file and noticed the "com.apple.macl" attribute didn't appear

7) Issued rm -R gws (No warnings came up!)

8) Minutes passed while I used Activity Monitor to see the "rm" process running and waited (impatiently) for it to end

9) Issued "ls -l" to confirm the directory was gone

10) Logged out as "root"

11) Logged in as me and disabled the "root" user

12) Used System preferences as in step 1 to select the internal drive for restart

13) Restarted on the internal drive

14) Logged in as me and confirmed what I had seen as root: the file was gone


Thanks to everyone who reviewed this post, and special thanks to D.I Johnson and to leroydouglas for taking the time to try to help.

Mar 21, 2020 8:15 PM in response to Gary Sears

Gary Sears wrote:

In the process of setting up my new iMac, I had to run the Migration Assistant more than once.

The upshot of this was a folder in "Deleted Users" having my username, which is "gws".
There were other folders in Deleted Users having other user names, which I was able to delete. The folder-in-question's icon is faded whereas the other username folders which I easily deleted were normal.

I can move this folder to the trash, but emptying the trash pops the error message that it cannot be deleted because it's needed by the OS: "“uux” can’t be modified or deleted because it’s required by macOS". A similar message appears for the next directory in the folder when I click "skip" in the error dialog, and indeed for many many "skips" until I click "stop" to dispose of the message.



How can I get rid of the "gws" folder from my Desktop folder?



You can not be logged into an account if you are going to delete it.

You can try and create a new user—give admin privileges and do your housekeeping here—






3-2-1 Backup Strategy: three copies of your data, two different methods, and one offsite.


Boot clone https://discussions.apple.com/docs/DOC-10081

How to use Time Machine to back up or restore your Mac: https://support.apple.com/en-us/HT201250

Use DiskUtility Restore feature https://support.apple.com/guide/disk-utility/restore-a-disk-dskutl14062/mac

note:

>System Preferences>Security & Privacy >Privacy>Full Disk Access

unlock the padlock, press the + button and add Disk Utility





Mar 23, 2020 9:12 AM in response to Gary Sears

If you haven't rebooted into safe mode anytime recently you should try that to see if it helps. Let the Mac OS do drive directory repair, cache clearing and other misc housekeeping. Often just booting into safe mode and logging in, then immediately rebooting normally will resolve an issue.  You should do this with all your external peripherals disconnected but the keyboard and mouse. Press the Shift key until you see the Apple logo and progress bar when you restart you Mac.


Booting into Safe Mode… 

Use safe mode to isolate issues - Apple Support


Note– starting up in Safe mode could take 10 minutes or more. Be patient.


Does the problem persist? Can you delete the bothersome folder while booted in safe mode?

Restart your Macintosh and re-evaluate the issue.


Mar 21, 2020 6:53 PM in response to Gary Sears

Try using Terminal.


Open Terminal.

Type "rm -R " (without quotations).

Then drag the offending folder into the Terminal window. The path to the folder will be added to the command line.

Press the Return key.


If Terminal can do so, it will delete the folder and its contents.

If Terminal asks for a password, type in your login password and press Return or Enter. Note that your password will not show up on screen as you type it.


Mar 22, 2020 9:14 AM in response to D.I. Johnson

Thanks for try to help, but I had already tried that and got an enormous scrolling list of every filename in that directory followed by "Permission denied", which finally I killed. I think when I backed the folder up onto an external drive there were well over a million files involved, so I didn't want to wait for well over a million denials.

Regards,

Mar 22, 2020 9:51 AM in response to leroydouglas

Hello and thanks for trying to help.


I had tried logging in only as my "Admin" userid. I had been able to change the access permissions on /Users/gws/Desktop to permit Admin access, and once inside /Users/gws/Desktop I tried "chmod -R 777 gws" to recursively grant universal access to all the files in subdirectories, but got another loooong scrolling list of failures to change.

Mar 23, 2020 10:11 AM in response to D.I. Johnson

Hello again -

As you suggested, I booted into safe mode (and confirmed this via "About this Mac"), then restarted. I loggerhead in again and used Terminal to get into my Desktop directory, then issued the recursive delete on the offending file and failed again. Here's what it looked like before I gave up:


GWS-iMac:Desktop gws$ rm -R gws


override r-xr-xr-x  _uucp/wheel restricted,compressed for gws/usr/bin/uux? y


rm: gws/usr/bin/uux: Operation not permitted


override rwxr-xr-x  root/wheel restricted for gws/usr/bin/cpan? y


rm: gws/usr/bin/cpan: Operation not permitted


override rwxr-xr-x  root/wheel restricted,compressed for gws/usr/bin/BuildStrings? y


rm: gws/usr/bin/BuildStrings: Operation not permitted


override rwxr-xr-x  root/wheel restricted for gws/usr/bin/loads.d? y


rm: gws/usr/bin/loads.d: Operation not permitted


override r-xr-sr-x  root/tty restricted,compressed for gws/usr/bin/write? 



Please note that I had earlier enabled the root user and tried to use Terminal to issue the recursive delete, getting the same series of override questions, and the same "Operation not permitted" results you see above. This file is an anchor!


Thanks for trying - I do appreciate it.

Regards.

Desktop folder having my username cannot be deleted

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