X

How to move a home folder in OS X

You can move your account's home directory to a new location on your hard drive, or to a different drive altogether.

Topher Kessler MacFixIt Editor
Topher, an avid Mac user for the past 15 years, has been a contributing author to MacFixIt since the spring of 2008. One of his passions is troubleshooting Mac problems and making the best use of Macs and Apple hardware at home and in the workplace.
Topher Kessler
3 min read

By default, the home folder for your OS X account will be located in the Users directory on your system's boot drive. You can, however, move this folder to a new location, such as to an external or secondary hard drive for better storage management, or even to a hidden folder on the system to keep your home directory more private.

To do this, you will need to perform two tasks: first move or copy the home folder itself to the desired location, and then update your account's directory entry to point to the new location. This can be done in a couple of ways, using the Finder and System Preferences, and the OS X command line.

You should be able to move this folder while logged in to your account, but it's best practice to perform such operations from a separate administrative account. Therefore, you should first create one in the Users & Groups system preferences, and then log out and log back in to the new account.

Home folder locations in OS X
The default location for home folders in OS X is the Macintosh HD > Users directory. Screenshot by Topher Kessler/CNET

Using the Finder, go to the Users folder and select your account's home folder. This usually appears as a small house when you are logged in (though will appear as a standard folder from the new admin account), and will be the same name as your short username (e.g., "tkessler" instead of "Topher Kessler").

Next, select this folder and copy it by pressing Command-C. Then go to the new destination location for the home folder. If this location is on your main boot drive, then press Option-Command-V to move the item, otherwise press Shift-Option-Command-V to invoke Apple's "Paste Exactly" feature, which will copy the folder but preserve all permissions settings.

If you would like to move the folder to a hidden location, such as the /var folder that contains the root user's account, then you can do so but will first have to reveal this folder. To do this, select "Go to folder" from the Finder's Go menu (or press Shift-Command-G) and then enter "/var" into the path field. Then move the copied home folder to this location as you would otherwise do.

An alternative to using the OS X graphical interface for this is to use the command line, which may be more convenient if you are logging in remotely or performing these steps when booted to Single User mode (root Terminal access). To do this, you would simply use the "mv" command to target the old home folder and its new location, in this case moving it to the /var folder:

sudo mv /Users/tkessler /var/tkessler

Home folder location in OS X
Changing the path to the new home folder location is the next step to take when moving a home folder. Screenshot by Topher Kessler/CNET

Once the folder has been copied or moved, now go to Users & Groups, authenticate, and then right-click your username and choose "Advanced Options." In here, either type the path to your new home folder location, select it by clicking the "Choose" button, or delete the contents of this field and then drag the new home folder to the field to auto-enter its full path.

This path update can also be done in the OS X terminal, by running the following command to edit the OS X directory. Even though this command uses the "-create" flag, it is not making anything new and is only updating the targeted user (/Users/tkessler) and updating its home directory entry to "/var/tkessler" (or to whatever location and username you would prefer):

sudo dscl . -create /Users/tkessler NFSHomeDirectory /var/tkessler

Note that similar to dragging the home folder to the home folder field in Users & Groups, you can also drag folders to the OS X Terminal to input their full paths. Therefore, in the above command, if you have entered everything up to the "NFSHomeDirectory" component, then you can enter a space and then drag the home folder to the Terminal window to complete its path.

Both of the Terminal commands here use "sudo" which will require you enter your password for the first one, but not for subsequent "sudo" commands unless you wait more than 10 minutes between running them (though a recently found bug allows changing dates to bypass this security feature).

If you are using the System Preferences then click OK to save the changes, and once the path is updated, you can now log into the account and it should load from the new location.



Questions? Comments? Have a fix? Post them below or e-mail us!
Be sure to check us out on Twitter and the CNET Mac forums.