Move special OS X user folders to external drive

Multithreaded JavaScript has been published with O'Reilly!
DEPRECATED: This post may no longer be relevant or contain industry best-practices.

Move special OS X user folders to external drive
Move special OS X user folders to external drive

I recently upgraded by MacBook Pro to having two hard drives (an SSD for the OS, and the platter drive for media). I wanted to put the “special” user folders onto the media drive, but still have the main user folder on the SSD. The reason it is better to do it this way is that caches and profile information, which is often read by the OS / apps, are still on the SSD, but then the larger files which don't require speed are on the media drive.

To do this, you need to delete the folders from your home directory, and soft-link the directories to the external drive.

Also, make sure you transfer the special folder icon from the old folder to the new folder, by clicking on the old folder, pressing Cmd + I, selecting the icon in the dialog, and pressing Cmd + C. Then, select the new folder, press Cmd + I again, select the icon, and press Cmd + V.

So, the first step is to copy all of, say, your Pictures directory onto the external drive. Then you'll want to use the command line to delete the old folder and link it:

sudo rm -rf ~/Documents && ln -s "/Volumes/Media/Documents/" ~/Documents
sudo rm -rf ~/Pictures && ln -s "/Volumes/Media/Pictures/" ~/Pictures
sudo rm -rf ~/Movies && ln -s "/Volumes/Media/Movies/" ~/Movies

Repeat this once for each folder you want to move (making sure you first copied the content over).

Unfortunately, the grey sidebar icons are no longer pretty and folder specific, just generic grey (even if you fixed the normal icon as specified above). Also, all of the folders will have shortcut symbols on them. I suppose you can't have your cake and eat it too.

Tags: #macos #cli
Thomas Hunter II Avatar

Thomas has contributed to dozens of enterprise Node.js services and has worked for a company dedicated to securing Node.js. He has spoken at several conferences on Node.js and JavaScript and is an O'Reilly published author.