Want a free year on Tuts+ (worth $180)? Start an InMotion Hosting plan for $3.49/mo.
If you’re wanting to invest in a new SSD drive to give your Mac a speed boost but can’t afford one large enough for all your data, or your boot drive is running out of space, in this tutorial I’ll show you how you can relocate your home folder to another drive or volume quickly and easily.
One Question: Why?
The most common reason would be because of an SSD drive. You’ll often find your home folder (which contains your music, videos and photos) is usually just too big to fit on to the SSD or it uses up the vast majority of the space. If you have an additional HDD available then you could locate all your data on that, freeing up space on the SSD to be used as your primary boot volume and place where apps are installed.
For example, I used to run a 13” MacBook Pro with a 60GB SSD and a 500GB HDD fitted. This was done using an MCE OptiBay, a device that fits as a replacement for the internal optical drive and provides space to mount a hard drive. At the loss of my rarely used DVD drive, I gained the ability to have a second hard drive fitted.
My home folder was around 300GB, far too big for my lowly 60GB SSD! Instead, I kept my OS X installation on the SSD and, instead, located my home folder on the separate 500GB HDD. This meant I could take advantage of the super quick boot times and rapid loading of applications yet still have all my music and videos accessible at all times.
You’ll often find your home folder is just too big to fit on to the SSD or it uses up the vast majority of the space…
Another reason would be if you are running out of space on your primary boot volume but have additional hard drives (if you’re running a Mac Pro) or you use a high-speed storage solution such as a Thunderbolt storage drive. You can move your home folder that takes up most of the space to another drive and this, in turn, frees up space on your Mac’s boot drive, preventing problems and space constraints.
I’d recommend only using this method if you have an SSD and HDD that are internal drives such as a modified MacBook Pro or Mac Pro with multiple drives. Whilst you will be able to relocate your home folder to any drive, including external ones, the performance hit you may receive from storing your home folder on something like an external USB drive wouldn’t make it practical. Thunderbolt storage devices would be an exception due to their exceptional speeds but there is no substitute for an internal drive.
Yep, as always - make sure you have a backup! If you are unsure how to do this, read Marius Masalar's article Create a Foolproof Backup System for Your Mac.
2: Copying The Home Folder
Before we tell OS X that we’re changing the home folder’s location, we need to copy it first. OS X won’t do that for us, it’s up to us to copy it to our new location.
Create an additional user account with administrator privileges in System Preferences > Accounts. Log out of any accounts and then log in with this new account.
We’re going to copy the home folder of our account called portable. Launch Terminal and enter the command
ls /Users. This will list the home folders in the
Users folder. As you can see, the folder I want to relocate is simply called portable.
Enter the command
ls /Volumes and make a note of the hard drive or volume you want to relocate the folder to. In this case, I am using the drive called External Device.
To copy the home folder, we’ll use a handy Terminal command called
ditto. I will be relocating my home folder using the following command:
sudo ditto -v /Users/portable/ /Volumes/External\ Device/Users/portable
The effect of that command is this: sudo means to run this as the root user, meaning I can copy all the files regardless of permission. It’s important to use this otherwise files will be missing and errors will occur.
ditto is the command to run, OS X’s version of a copy command. The -v just adds the feature called Verbose mode and will print a line to the Terminal window every time a file is copied (it’s a nice way of seeing how it’s progressing).
The first path, /Users/portable is the target folder that I want to copy and the path afterwards is where I want to put it. If the new location doesn’t exist, it will just create it for us. External Device has a backslash in it’s name because a space cannot be used on its own as it usually separates commands. The backslash just means “the character after me is part of the name, don’t assume it’s the next part of the command”.
Tip: You don’t need to always enter the full path of a folder, you can usually press Tab and it will attempt to autocomplete it for you.
Once the copying is complete, the terminal window will go back to a prompt and you’ll be able to start entering new commands. At that point, you can quit Terminal.
3: Change The Home Folder Location
That’s the hard part over! Once the folder has copied, let’s confirm it has indeed done so.
it’s time to tell OS X we’ve moved home… folder!
Open System Preferences and click on Accounts.
Right-click on the user account you’re relocating and select Advanced Options…
This section looks a bit daunting, with random numbers and red writing! Don’t worry, we’re not going to be making any drastic changes. All we need to do go to where it says Home Directory and then click Choose…, and finally select the new home folder we copied using Terminal before.
Now once you’ve chosen the new location, the Home directory path should reflect the change.
4: Test it Out
Now, log out and restart your Mac. Log in as the user who’s folder we copied and as long as you see the desktop and all the files where they should be, you’ve done it! To confirm the home folder is in the new location, open a new Finder window and go to your home folder. Right-click on the window’s title and it will bring up the full path.
As you can see, the home folder here is running from my external device.
5: Delete The Old Home Folder
Now, we only copied the home folder. That means it is still there in the Users folder, so we’ll need to delete that.
In the Finder, use the menu and select Go > Go to Folder…. Type in /Users and press enter.
Locate the old home folder and move it to the trash.
You’ve now successfully relocated your home folder to a new location! This will free up plenty of space on the SSD or the drive the home folder was previously located on. So whether you’re wanting to run an SSD as your boot drive and keep your home folder elsewhere or you use multiple drives and your boot volume is running out of space, you’re now able to do so.