MacOS – Deleting a network user profile from computer

macosnetwork-user

My computer is hooked up to a school domain, and a few people used it to log on. Now, the accounts of the other users are still here. I don't have any of their files, but just the empty shell accounts OS X creates by default. It's still about 250MB per user (from the default stuff OS X puts in, plus caches they used while browsing etc.).

Can I delete these user folders safely (with sudo)? Or do I need to do some Directory Services magic to make sure OS X knows the users are gone?

EDIT: The users aren't in my "/Search/Users" DirectoryServices list, nor are they in /etc/passwd. Their user folders are shown as being owned by numeric IDs, rather than their actual names.

Best Answer

You do need to do some Directory Services magic because normally /etc/passwd doesn't really exist on a Mac and is being created each time you access it from the records in Open Directory.

To remove your users from the terminal, run:

dscl . -delete /Users/username

Where username is the user you want to remove.

Otherwise, you should be able to do this from the GUI by going to System Preferences -> Users & Groups -> Select the user from the user column and remove it with the minus. It will ask you about removing the user's home directory and you want to say yes.

---Edit---

Check if the users exist in the system with:

dscl . -list /Users

If they don't exist, then you are safe to remove the home directories located in the root of the filesystem at /Users/username.