4

Some time ago I had a user called "xy" on my system. I have deleted the user but in the /Users directory there are folders called "xy" with a Desktop, Library etc. in it.

Why are they not deleted and can I delete them manually?

3 Answers 3

12

TLDR: Deleting this user's home folder will not harm your system. It will, obviously enough, delete any of the files you created when you were logged in as the previous user.


How is it possible that there be a folder for a user who doesn't appear at the login window?

OS X keeps track of users and their passwords using Directory Services. On most people's computers the Directory Services files are stored in /var/db/dslocal. This database stores the names of users, and other information, such as the location of their home folder. When you deleted your user, your Mac removed the account entry (from the dslocal database), but did not delete the home folder stored in the /Users folder.


So why didn't the system automatically delete the home folder when it deleted the user from the database?

When you delete a User from System Preferences, you are asked what to do with the home folder itself. You can see from this screenshot which option you must have accidentally chosen:

Oops


What's the best way to delete the old user's home folder?

I would suggest logging into the account one last time to ensure it does not contain any files you wish to keep, and then deleting both the user record and its files (as you originally intended). To do so:

  1. in System Preferences > Users & Groups, create a new account with the exact same name as the old user's home folder. The system will ask if you wish to use the existing home folder. Choose to do so.
  2. From the Apple menu, choose "Log out" and then log back in to the old user (ie: the user you just recreated).
  3. Take look around in the user's Pictures folder, Documents folder, etc to make sure there are no files you wish to keep
  4. Log back in to your normal account
  5. Delete the old user from "Users & Groups" but this time, choose "Delete the home folder"
2
  • 2
    FYI: the username in that screenshot was intended as a reference to the Graham Greene character. According to Wikipedia there was also a 1920s American pornographic film director by that name. I had no idea.
    – username
    Aug 12, 2012 at 5:55
  • On Mojave I never got asked what to do with the home folder. I was also unable to perform step 1 since the old user's folder had a space in the name but macos didn't allow me to type that character...
    – Andreas
    Dec 1, 2018 at 16:52
6

What version of OS X are you using?

In Mountain Lion, when you delete a user, you are presented with a dialog with the option to delete the home folder of the user you are deleting.

It shouldn't be any problem deleting it. It's personal settings and assets stored. Nothing global to the system. Do delete you log in with an administrator account and do one of

  • go to /Users in the Finder and delete the "xy" folder
  • open Terminal and run sudo rm -rf /Users/xy
0

How to delete a user folder from orbit


To avoid needing to create a user account with the same user name as the orphaned /Users/ home folder. You can simply delete the folder if you do not care about any data loss. Providing your current account is an admin account you can elevate your privileges to delete that orphaned home folder.

DANGER: "rm -rf" is risky do not make a typo on the <user_home_folder>.

Open Terminal

$ cd /Users
$ sudo rm -rf <user_home_folder>
Password:

The command "sudo rm -rf" means: Super User Do, Remove This folder recursively and all sub-folders, Force it and don't warn me about deleting these folders/files. It is dangerous because you can permanently delete something by accident if you make a typo. For example, "sudo rm -rf /" would delete your entire Macintosh HD drive.

DANGER: "rm -rf" is risky do not make a typo on the <user_home_folder>.

If this does not work, you may have some disk errors at play (happened to me just the other day). Boot in Recovery mode by holding CMD+R when powering on, let go after the bong or when you see the Apple logo. Run Disk Utility and check your internal Macintosh HD drive with First Aid. If this doesn't work, make a creatable boot OS flash drive and boot with that and run Disk Utility on the entire internal disk.

How to create a bootable installer driver for macOS

https://support.apple.com/en-us/HT201372

1
  • How is this answer different from this existing answer? I'm not clear on "from orbit" as it's being done locally and how does creating a bootable USB installer come into play? Why would someone need that to remove a Users folder?
    – Allan
    Jul 27, 2020 at 23:57

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .