OS X: How to change user account name or home directory name
Learn how to change your user account name and home directory name (which should match) by using the advanced procedure described below.
About the account name
Each user in Mac OS X has a "Full Name" (referred to as "Name" in Mac OS X v10.5.8 or earlier) and an "Account name" (referred to as "Short Name" in Mac OS X v10.5.8 or earlier) as defined in the Users & Groups pane of System Preferences (referred to as Accounts pane or Users pane in Mac OS X v10.6.8 or earlier). The account name can contain up to 255 lowercase characters with no spaces. This is the name used to create a user's home directory (also known as the user's Home or Home folder) in the Users folder. Once the user has been created, the account name (or short name) cannot be changed in the Users & Groups pane of System Preferences.
Changing the account name
Though there are other methods by which an advanced user may change the short name and related information, the easier and safer workaround is described below.
Before following these steps, you should back up your important data. OS X includes Time Machine, a feature that helps you back up and restore your important files to another drive or network volume.
For Mac OS X v10.5 or later
- Enable the root user.
- Log in as root.
- Navigate to the /Users folder.
- Select the Home folder with the short name you want to change, and rename it just like you would rename any folder. Keep in mind that the account name must be all lowercase, with no spaces, contain only letters or contain a mix of letters and numbers, and it cannot be the same as an existing user's Full Name.
- Use the Users & Groups pane (Accounts pane in Mac OS X v10.6.8 or earlier) in System Preferences to create a new user with the Account name or Short Name that you used in the previous step.
- Click OK when "A folder in the Users folder already has the name 'account name'. Would you like to use that folder as the Home folder for this user account?" appears. Note: This will correct the ownership of all files in the Home folder, and avoid permissions issues with the contents.
- Choose Log Out from the Apple menu.
- Log in as the newly created user. You should be able to access all of your original files (on the desktop, in Documents, and in the other folders of this Home).
- After verifying that your data is as expected, you can delete the original user account via the Users & Groups pane (Accounts pane in Mac OS X v10.6.8 or earlier).
- Disable the root user.
For Mac OS X v10.4.11 and earlier
- Optional step: As a precaution, you may disable automatic login prior to performing this procedure. You might want to back up important data, too. In the event that you restart the computer for any reason before completing the procedure, this would prevent complications from having displaced the user selected for automatic login. (For Mac OS X v10.1.5 or earlier, automatic login is found in the Login preference pane. For Mac OS X v10.2 and v10.3, it is found in the Accounts preference pane.)
- Mac OS X v10.3 or later: If FileVault is enabled, temporarily turn it off, which will log you out.
- Enable the root user and log in as root.
- For Mac OS X v10.2 or later: Open the Accounts pane of System Preferences.
For Mac OS X v10.1.5 or earlier: Open the Users pane of System Preferences.
- In the Name list, locate the user account with the short name that you want to replace. This will be referred to as the "original user".
- Note whether or not the original user is identified as an administrator, which appears in the Kind column to the right.
- Click New User. For Mac OS X v10.3 or later, this is the plus (+) button.
- Complete the Name and Short Name fields as desired. Be sure that the Short Name is exactly as you want it to appear.
- For Mac OS X v10.2: Fill in the New Password and Verify fields.
For Mac OS X v10.1.5. or earlier: Click the password tab, then fill in the Password and Verify fields.
- If the user you are replacing is an Admin user, then select the checkbox for "Allow user to administer this computer". For Mac OS X 10.3, click the Security tab to locate this setting.
Note: This checkbox is dimmed and already selected if there is not another Admin user. Mac OS X requires at least one Admin user.
- Click Save. (Skip this step for Mac OS X v10.3.)
- Quit System Preferences.
- Click the Finder icon in the Dock.
- Choose Computer from the Go menu.
- Open the Users folder in the Mac OS X disk.
- Open the folder with the short name of the new user that you just created.
- Drag the contents of this folder to the Trash.
- Choose New Finder Window from the File menu. Be sure to position the new window so that you can see both Finder windows.
- In the new window, open the folder of the original user.
- Press the Option key as you drag the contents of the original user's folder into the new user's folder (that you emptied in Step 16). This makes a copy of the contents.
- Close one of the Finder windows.
- Open the Terminal application (located at /Applications/Utilities/).
- Type: chown -R <new_name> /Users/<new_name>
Important: Replace "<new_name>" with the actual short name of the new user you just created. For example, if the new user had the short name "jacques", you would type:
chown -R jacques /Users/jacques
- Press Return
- Quit Terminal.
- Choose Log Out from the Apple menu.
- Log in as the new user. You should be able to access all of your original files on the desktop and in the folders of the Home directory.
Important: If you do not have access to your original items, log out and log back in as root, then repeat Step 22. Also, be sure that you did not place the wrong files in the Trash in Step 16.
- Choose Home from the Go menu.
- Open the Library folder, then the Keychains folder inside it.
- Select the keychain, which should still have the short name of the original user.
- Choose Show Info from the File menu.
- In the Info window that appears, choose Name & Extension from the pop-up menu.
- Change the name to match the new user's short name.
- Close the Info window.
- Open the Keychain Access application, located in the Utilities folder.
- From the Edit menu, choose "<new_name> Settings". For the user Jacques, this would appear as: "jacques Settings".
- Click Change Passphrase.
- Enter the desired password, then click OK. You may use the same password again or set it to match the login password of the new user.
Note: This step prevents you from discovering later that the keychain had retained an older password.
- Quit Keychain Access.
- Disable the root user.
- If everything is working correctly, you do not need to log back in as root to empty the Trash. The folders you put there occupy a negligible amount of disk space.
- Depending on what software you have installed, you may wish to rename other files and folders that may have been created under the original user short name to match the new user short name.
- Once you are certain that everything is working properly, you may want to delete the Home directory (folder) of the original user, which should be empty. For instructions on how to do this, see this article.
Important: Do not empty the Trash yet. In the event that you accidentally move contents of the wrong folder, you may recover them from the Trash after discovering your mistake.
Note: Although you can change your Home name in Mac OS X v10.3 or later, you usually shouldn't.