Your Mac’s home directory, or home folder, is represented by a little house in the Finder and is the default location for your documents, music, photos and other items on your computer. The name of the home folder is also your Mac account username, or “shortname” in UNIX parlance.
Since these items are related, the process for renaming the home folder and changing your username is similar to moving your home folder to another location such as a second hard drive. Here’s how it’s done.
Renaming Your User Account and Home Folder
The most common reason to rename a home directory and Mac account name is to correct a misspelling or change the name if a new user replaces an old one, such as an employee change in a business. The old or incorrect name has no ill effect on computer operations but can be psychologically annoying when things aren’t correct.
IMPORTANT: this is an advanced procedure that can result in loss of access to your data if done incorrectly. Make sure you read and feel comfortable with these instructions and how to use Terminal before making any changes. Also, BACK UP YOUR DATA before you begin. Time Machine is OK, a Hard Drive Clone is better. Make sure you can revert back to the old system if anything goes wrong.
For this example let’s start with a user named Bob Smith with the username bobsmith. We wish to change this for a new user, Jane Doe, with the username janedoe.
You need to use a second account on the Mac with administrator privileges to make the change. Log out of Bob Smith’s account (under the Apple menu), then log in to the separate admin account and open System Preferences. Choose the Users & Groups preference pane, click the lock to authenticate and enter your admin password.
Next, right-click (or control-click) on Bob Smith’s account in the left hand pane and choose Advanced Options…
This will bring up another window with a warning not to muck with things if you don’t know what you’re doing (always good advice).
Two things need to be changed in this dialog: the entries for Account name and the Home directory. For Account name simply replace bobsmith with janedoe.
Next, in the Home directory field change the existing entry as follows:
old: /Users/bobsmith
new: /Users/janedoe
new: /Users/janedoe
Double-check the entries for spelling and typos, then click OK. Your Mac will ask Are You Sure to confirm you indeed want to make this change, so this is the point of no return.
Finally, back in System Preferences, change the Full name you see in the account pane from Bob Smith to Jane Doe. The Full name is really just an alias to the shortname that’s easier for you and I to remember.
These actions change the Mac user ID record internally for the account. We now need to rename the actual home directory. This step is done with the Terminal application, located inside your Applications –> Utilities folder. Launch Terminal, then type the following at the command prompt:
sudo mv /Users/bobsmith /Users/janedoe
Make sure you type the old and new usernames correctly, then hit Return. You will be prompted to enter your admin account password. Type that in – the letters won’t show onscreen – then hit Return again. This command moves (mv) the entire folder from the old location to the new one, which in this case is effectively just a rename operation. Since the move is “in-place” on the same hard drive the process should only take a few seconds, then a new blank command line will appear.
When finished quit Terminal and System Preferences, then reboot your Mac. Upon restart the account name and home directory will both have been renamed to janedoe.
Moving Your Home Folder to a Different Drive
Sometimes you’re not looking to rename an account but actually move the home directory to a separate drive or partition. This is a common setup for servers and can also be used on any system where you want to keep things separate, such as having the Operating System and Applications on a Solid State Drive and the user data on a larger (but slower) hard disk drive.
The process is similar to renaming a home folder, but in this case we’re keeping the same username and changing the location. As above, log out of the account to be changed and log in to a second admin account. Open System Preferences –> Users & Groups, right-click on the account to be changed and choose Advanced Options…
In the Advanced dialog box leave the account name as is (bobsmith) but change the location of the Home directory. Let’s say we want to move the home directory to a hard drive named Employees. Using the Finder create a folder named Users on the Employees drive. Then, change the Home directory entry as follows:
old: /Users/bobsmith
new: /Volumes/Employees/Users/bobsmith
Correct entry and spelling of this data is critical. Verify there are no typos, then click OK to save these changes.
Terminal is your next step, and this time the files will actually be moved between the two hard drives. Open Terminal and at the command prompt type:
sudo mv /Users/bobsmith /Volumes/Employees/Users/bobsmith
Enter your admin account password when prompted, then hit Return. This operation may take some time depending on how much data has to be moved, do not interrupt the process or use the Mac for other tasks while this is happening. When the copy is complete you will see a new command line prompt appear in the Terminal window.
Verify that the folder has actually moved to the new drive, then restart the Mac and you should be good to go. Note that the second drive should be a Mac-formatted volume, and if it’s not an internal disk it will need to be connected and powered up whenever you’re using the Mac for the home directory to be accessible.
Changing the Account Name on Pre-Leopard Systems
The above steps are common procedures for UNIX-based systems but are made simpler by Apple’s inclusion of the Advanced Options dialog for changing account names. The process is a bit more complex for pre-Leopard Macs, but if you’re running Tiger (OS X 10.4.x) or Panther (10.3.x) on your Mac there’s a handy utility available which can automate the name changing for you.
ChangeShortName is a freeware utility by Dan Frakes which automates changing the username via a series of pre-configured terminal scripts. As above, log out of the user account to be changed and make changes from a second admin account on the Mac. ChangeShortName will prompt for the old and new names, make the necessary changes, then prompt you to reboot your machine.
Note that this utility will not work with OS X 10.5.x or higher. If your Mac is running something even older than Panther, frankly it’s time to upgrade to something newer! Very little current software runs under these older OS versions, time and energy is better spent migrating to a newer system.
Source: www.cultofmac.com/126621/how-to-move-or-rename-your-mac-home-folder-macrx