The fastest way to change your Mac username in Terminal
You can change your Mac username through Terminal by using the dscl command, which manages directory services on your computer. The process takes about five minutes and requires you to know your current password. Unlike the graphical method through System Settings, Terminal lets you change both your account name (what appears in login) and your full name (what shows in Finder and Mail) in one session.
The command structure is straightforward: you tell dscl which user record to change, which field to modify, and what the new value should be. macOS keeps these two pieces of information separate in its user database, so you can update one without touching the other.
Key Takeaways
- Terminal requires your current password to make any changes, and you must be an administrator on your Mac to proceed.
- The dscl command changes your account name (login name) and full name separately, so you may need to run it twice if you want both updated.
- After changing your account name, your home folder path does not update automatically — you will need to rename it manually in Finder or Terminal.
- Some applications may not recognize the new username when ready and may require you to log out and back in, or restart the process.
- If you make a mistake during the process, you can undo it by running the same command again with your old username as the new value.
Before you open Terminal: what you need to know
Check that you have administrator access on your Mac. If you are not sure, open System Settings, go to General, then Users & Groups, and look for "Admin" next to your name. If it is not there, you cannot use Terminal to change your username — you will need to ask an administrator to do it for you.
Write down your current username and your new username before you start. Your current username is what appears when you type whoami in Terminal. Your new username should be lowercase, contain no spaces, and ideally match the format of your current one (usually firstname or firstname.lastname).
Know that changing your account name does not automatically rename your home folder. If your current username is "sarah" and you change it to "sarah.chen", your home folder will still be called "sarah" until you rename it manually. This can cause confusion later, so most people rename the folder to match the new username.
The Terminal commands to change your account name
Open Terminal (find it in Applications > Utilities or search for it with Spotlight). You will see a prompt that ends with a dollar sign or percent sign. Type the following command, replacing "oldusername" with your current username and "newusername" with what you want it to be:
sudo dscl . -change /Users/oldusername RecordName oldusername newusername
Press Enter. Terminal will ask for your password. Type it in (you will not see the characters appear) and press Enter again. If the command succeeds, you will see a new prompt with no error message. If you see "Authentication failed" or "Permission denied", your password was wrong or you do not have administrator access.
Next, change your home folder path to match. Type this command, again replacing the usernames:
sudo mv /Users/oldusername /Users/newusername
Press Enter and type your password again. This renames your home folder so it matches your new account name. Without this step, your home folder will still say "oldusername" even though you log in as "newusername", which can break some applications and make backups confusing.
Changing your full name separately from your account name
Your account name (what you type at login) and your full name (what appears in Mail, Finder, and other applications) are stored separately. If you only want to change one, you can do that without touching the other.
To change only your full name, use this command, replacing "username" with your actual account name and "New Full Name" with what you want to appear:
sudo dscl . -change /Users/username RealName "Old Full Name" "New Full Name"
If you do not know your current full name as it is stored in the system, type this command first to see it:
dscl . -read /Users/username RealName
This command does not require sudo and will show you exactly what the system has on file. Copy that text and use it in the change command above.
What to do if something goes wrong
If you typed a command incorrectly and got an error, the simplest fix is to run the same command again with the correct spelling. Terminal does not make changes until the command completes successfully, so a typo just means nothing happened.
If you changed your account name but cannot log in, restart your Mac and hold down Command-S to boot into Single User Mode. Type fsck -fy to check your disk, then type reboot to try again. If you still cannot log in, you may need to use Recovery Mode (Command-R at startup) to reset your password or restore from a backup.
If you changed your account name but applications are not recognizing it, log out completely (Apple menu > Log Out) and log back in. Some applications cache your username when you first log in and do not update it until you restart them or restart your Mac entirely.
Renaming your home folder in Finder if you prefer not to use Terminal
If you changed your account name but do not want to use the Terminal command to rename your home folder, you can do it in Finder instead. Open Finder, click on your home folder (it has a house icon), then right-click on the folder that matches your old username and select "Rename". Type the new username and press Enter.
macOS may warn you that changing the folder name could cause problems. Click "Use the new name" to proceed. After you rename it, restart your Mac so that the system updates all the paths that point to your home folder.
Frequently Asked Questions
Will changing my username affect my files or applications?
Your files stay where they are — changing your username just changes the path to reach them. Some applications may need to be restarted to recognize the new username, and a few older applications might not work until you reinstall them. Most modern applications handle the change without any trouble.
Can I change my username without restarting my Mac?
You can run the Terminal commands without restarting, but you will need to log out and log back in for the change to take full effect. Some applications will not recognize the new username until you do. A full restart is safest and only takes a few minutes.
What if I forgot my password and cannot run the sudo commands?
You will need to reset your password first. Restart your Mac and hold Command-Q at the login screen, then select "Forgot password?" and follow the prompts. Once you have reset your password, you can use Terminal to change your username.
Can I change my username back to what it was before?
Yes. Run the same dscl command again, but swap the old and new usernames — so if you changed from "sarah" to "sarah.chen", run the command with "sarah.chen" as the old username and "sarah" as the new one. You will also need to rename your home folder back in Finder or Terminal.
Do I need to change my password after changing my username?
No. Your password is stored separately from your username and does not change when you update your account name. You log in with your new username and your same password.