Delete a user or group on Mac
If you’re an administrator, you can delete users that you no longer want to have access to your Mac. You can also delete groups you don’t want.
On your Mac, choose Apple menu
> System Preferences, then click Users & Groups.
If the lock at the bottom left is locked , click it to unlock the preference pane.
Select the user or group you want to delete, then click the Remove button (looks like a minus sign) below the list of users.
If other users are logged in to this Mac now, you can’t select them.
Do one of the following:
Save the home folder as a disk image: Select “Save the home folder in a disk image”. This archives all the user’s documents and information so the user can be restored later if needed. The disk image is saved in /Users/Deleted Users/.
Leave the user’s home folder as is: Select “Don’t change the home folder”. The user’s documents and information remain and the user can be restored later if needed. The home folder remains in /Users/.
Remove the user’s home folder from the computer: Select “Delete the home folder”. The user information is deleted and the storage space is freed.
Delete a sharing-only user or a group: Click OK.
A sharing-only user doesn’t have a home folder.
Click Delete User.
If you don’t delete a user’s home folder, you can restore the user and the contents of the home folder.
Источник
Question: Q: How to delete user from terminal in server application
I am running the server application version 5.0.15 and I am wondering how to delete a user from the accounts in the server. I know that you can go in and delete the account in the GUI but I was hoping to automate the processes since I have a lot to do. I was thinking that if I find a terminal command to do it I could create a shell script.
Posted on Jun 12, 2017 12:09 PM
Helpful answers
Usual rummaging involves first having a full backup (mistakes here are bad), listing out the users, rummaging and viewing as needed, then deleting the target user:
dscl . -list /Users
dscl . -read /Users/
sudo dscl . -delete /Users/
There are some scripts for this purpose posted around the ‘net (that clean up the login directory, etc), but I don’t immediately have a pointer to one that I’d recommend.
Jun 13, 2017 8:32 AM
There’s more to the conversation
Loading page content
Page content loaded
Usual rummaging involves first having a full backup (mistakes here are bad), listing out the users, rummaging and viewing as needed, then deleting the target user:
dscl . -list /Users
dscl . -read /Users/
sudo dscl . -delete /Users/
There are some scripts for this purpose posted around the ‘net (that clean up the login directory, etc), but I don’t immediately have a pointer to one that I’d recommend.
Jun 13, 2017 8:32 AM
Thanks for the reply! However, the users I want to delete are in the LPADv3/127.0.0.1/Users folder. I can access this if I enter dscl and use that mode, but if I try to use dscl . -list /LPADv3/127.0.0.1/Users it says the path does not exist. I think it has something to do with the fact that I can not see the level above the «local» directory. I have tried with out the «.» but I just get a » Cannot open remote host, error: DSOpenDirServiceErr»
Источник
Mac: How to delete a user on macOS
— Jul. 25th 2018 12:00 am PT
Whether you’ve been sharing your Mac with someone or just need to tidy up your machine, follow along below for how to delete user accounts on macOS.
We’ll take a look at removing the guest user account as well as deleting any other users you may have on your Mac. First let’s dive into how to delete admin or standard user accounts.
Mac: How to delete a user on macOS
- Make sure you’re logged in to a user account with admin priviledges
- Open System Preferences and click Users
- Select the account you’d like to delete and tap the –icon just under Login Options
- Choose whether you’d like to save or delete the home folder
- Click Delete User
Follow along below for a more detailed walkthrough:
You may need to click the lock in the bottom left corner and enter your password to make changes.
After you’ve selected the user account you’d like to delete, click the – icon in bottom left corner just below Login Options.
Next, you’ll have three choices for what you’d like to do with the home folder.
Depending on how much data is contained on the user account, it may take some time for it to be deleted.
If you’d like to remove the guest user account option, click on Guest User and uncheck the box at the top as shown below.
For more help getting the most out of your Apple devices, check out our how to guide as well as the following articles:
FTC: We use income earning auto affiliate links. More.
Источник
Delete own user from Mac OS
I was wondering if it is possible to delete my one and only user account because I am creating a script to add and remove users on my Mac.
I have this command here:
I’m a little bit worried to test that because I don’t want to delete my only user with all my files so is it possible?
1 Answer 1
The command sudo /usr/bin/dscl . -delete «/Users/ali» will remove the user ali from the local Directory Services database.
After login out you won’t be able to login with user ali again. The user folder of ali won’t be deleted.
To delete the folder /Users/ali and its content an additional command is necessary.
The user ali can be recreated though by booting to single user mode and using the remove .AppleSetupDone file trick in a two-stage process.
- Create a new admin with a different name than ali (e.g. ali2)
- After the configuration is done create a new admin with a different name than ali (e.g. ali3)
- Logout as ali2 and login as ali3
- Modify ali2 (e.g. name/user directory/user id etc.) with Users & Groups PrefPane/Directory Utility.app/command line to restore the previous entries of ali.
This won’t work if your main volume is encrypted with FileVault2!
It’s absolutely not recommended to test user creation/deletion scripts like this on your production Mac. Download VirtualBox, create a virtual machine running macOS and test your scripts inside there.
Источник
How to Delete a User Account in Mac OS X
Macs with multiple user accounts sometimes need to delete a user account. Maybe you no longer need a specific user account, or you’re removing an old login, or just cleaning house, whatever the case, it is easy to remove a user from Mac OS X.
The method we’ll cover allows removal of any user account, whether it is an admin account or a standard account. Keep in mind that by deleting a user account, not only is the user account removed from the Mac which thereby prevents that user from logging into the Mac again, but in most situations that users files and data is also deleted as well. There are options to save the user Home folder data while still removing the user account login, however, or you can choose to completely and securely erase both the user account and the users Home folder.
How to Delete User Accounts from a Mac
The process of removing a user account is irreversible. Be sure to back up your Mac before deleting a user account or any user data.
- Go to the Apple menu and choose “System Preferences”
- Select the “Users & Groups” preference panel
- Delete user account but save the home folder to a disk image
- Delete user account but keep the user home folder in /Users directory
- Delete user account and delete the home folder (optionally, choose to erase home folder securely) – this completely removes the user account and that users files and apps from the Mac
If you chose the option to completely remove the user account and the users Home folder, any and all files and apps in that users home directory will be deleted. If you choose one of the options to preserve the Home folder, it will be located in the /Users/ folder or the Deleted Users folder.
While deleting a user is permanent, you can always create a new user account on a Mac at anytime, though if the intention is simply to allow basic guest usage like internet access, then setting up the Guest User account on Mac OS X is often a better idea. Another option would be to hide a user if you don’t want it to be widely visible, which allows logins on that user ID but it won’t be visible in the obvious places throughout Mac OS X.
Источник