The fastest way to change your Mac username from Terminal
You can change your Mac username using the Terminal without restarting or creating a new account. The process involves two separate changes: your short username (the one that appears in file paths and command prompts) and your full display name (the one that shows on the login screen). Most people need to change both.
The short username is harder to change because macOS locks it while you are logged in. The standard approach is to use the dscl command (directory services command line) to modify it while your account is still active, though this requires some caution. The display name is simpler and can be changed when ready.
Key Takeaways
- Your short username (used in file paths like /Users/oldname) and your display name (shown on login screen) are separate and both can be changed from Terminal.
- Changing your short username requires the dscl command and works best when you are the only admin account on the machine.
- After changing your short username, you must update the home directory path or your files will become inaccessible.
- If you encounter permission errors, you may need to disable System Integrity Protection temporarily, which requires restarting into Recovery Mode.
- Testing your changes before logging out prevents you from being locked out of your account.
Changing your display name (the straightforward part)
Your display name is what appears on the login screen and in System Settings. You can change this without affecting file paths or permissions. Open Terminal and run this command, replacing "newdisplayname" with what you want to see:
dscl . -change /Users/yourusername RealName "Old Display Name" "New Display Name"
Replace "yourusername" with your actual short username (the one in your file path), and replace both the old and new display names with the exact names you want. If your current display name has spaces or special characters, put the whole thing in quotes. The change takes effect when ready, though you may need to log out and back in to see it everywhere.
Changing your short username (the careful part)
Your short username is the folder name under /Users/ and the name that appears in your command prompt. Changing it is more involved because the system uses it to track file ownership and permissions. The command is:
dscl . -change /Users/oldusername RecordName oldusername newusername
Replace "oldusername" with your current short username and "newusername" with what you want it to be. The new username must be lowercase, contain no spaces, and be different from any existing usernames on the machine. If you get a "permission denied" error, your system may have protections that prevent this change while you are logged in.
Moving your home directory to match the new username
After you change your short username, your home folder is still named after your old username. This creates a mismatch: the system thinks your home is at /Users/newusername but the actual folder is still /Users/oldusername. You must rename the folder to match.
The safest way is to do this from System Settings rather than Terminal. Go to System Settings > General > Transfer or Reset, then look for the option to change your home directory location. If that option is not available, you can rename the folder from Terminal using:
sudo mv /Users/oldusername /Users/newusername
You will be prompted for your password. After this runs, verify that your home directory is correct by opening a new Terminal window and typing pwd — it should show /Users/newusername.
What to do if you get a permission denied error
If dscl returns "permission denied," your Mac has System Integrity Protection (SIP) enabled, which prevents even admin accounts from modifying certain system records while logged in. You have two options: disable SIP temporarily, or create a second admin account and change the username from that account.
To disable SIP, restart your Mac and hold Command + R to enter Recovery Mode. Open Terminal from the Utilities menu and run csrutil disable. Restart normally, make your username changes, then restart into Recovery Mode again and run csrutil enable to turn SIP back on. This is safe but requires two restarts.
The second admin account method is slower but avoids touching SIP. Create a temporary admin account in System Settings, log into it, then use dscl to change the original account's username. When you are done, delete the temporary account.
Testing your changes before you log out
Before you close Terminal or restart, verify that everything worked. Type whoami to confirm your short username is correct. Type pwd to confirm your home directory path matches. Type ls ~ to confirm you can still read your home folder. If any of these fail, your account may be in an inconsistent state.
If something went wrong, you can usually undo it by running the dscl commands again with the old and new names swapped. If you cannot access your account at all, restart into Recovery Mode and use the Reset Password utility to regain access, then try again more carefully.
Why your files might become inaccessible after changing username
Every file on your Mac is owned by a username, not a person. When you change your username without updating the home directory path, the system still sees your files as belonging to "oldusername" even though you are now "newusername." This can prevent you from reading or modifying your own files.
If this happens, you can fix it by running sudo chown -R newusername /Users/newusername to reassign all files in your home directory to your new username. This requires your password and may take a minute or two if you have many files. After it completes, restart Terminal and test again.
Frequently Asked Questions
Can I change my username without using Terminal?
macOS does not provide a graphical way to change your short username. You can change your display name in System Settings under Users & Groups, but that does not change the folder name or the name used in file paths. Terminal is the only method that changes the actual short username.
Will changing my username break my applications?
Most applications store their settings in a location that moves with your home directory, so they continue to work. However, some older applications or scripts may have hardcoded paths like /Users/oldusername. If an process stops working after you change your username, check its preferences or documentation to see if it needs a path update.
What if I forgot my old username?
Open Terminal and type whoami to see your current short username. You can also look at the folder names under /Users/ to see all accounts on the machine. If you cannot access Terminal, restart into Recovery Mode and open Terminal from the Utilities menu.
Can I change my username if I am not an admin?
No. You must be an admin account to use dscl to modify your own username. If you are a standard user, ask an admin to create a second admin account for you, then log into that account and change your original account's username from there.
Do I need to change my password after changing my username?
No. Your password is stored separately from your username and does not change. You will still log in with the same password, but your short username will be different in Terminal and file paths.