Stupid Symlink Tricks

I do all of my work on my laptop. I have an external drive for large projects, but the desire to keep everything on the laptop means that I really only want to spend internal hard drive space on the essentials.

I love LiveType, but I only use it once in a blue moon, generally when finishing a project up. Unfortunately, Apple’s dopey installation program requires that LiveType (like all the Pro apps) be installed completely on the internal drive. Here’s how to route around their bogosity. All we’re going to do is use the unix ability to have symbolic links from one directory to another allow us to store the most egregiously large directory on our external drive. Symbolic links are created with the ln command.

(I am assuming that your external drive is hooked up during this procedure. For instructional purposes, let’s assume the drive is named external)

That’s it! You’re done. (You could of course just do sudo bash and then issue the mkdir, mv, and ln commands from a root shell, but that violates the principle of being conservative when wearing your root hat).

You can do this not only with LiveType, but with Soundtrack, and in fact even with iTunes, if you’re willing to accept parts of your collection being unavailable when you’re not tethered to your drive. Note that iTunes goes to greater lengths than most to disallow this technique (in particular, it will actually insist that your “iTunes Music” directory is on a local drive, but you can set up symlinks within that directory for specific artists. I have two little shell scripts to let me migrate data back and forth as I desire. Here’s one:

% cat #!/bin/sh mv “$1” “/Volumes/My External Drive/Music” ln -s “/Volumes/My External Drive/Music/$1”

…so from within my iTunes Music directory "The Beatles" will migrate the entire Beatles directory to the external drive, and set up the correct symlinks so that I can still access it as needed. Of course, there’s an to reverse the process.

One thing of note is that most of the HFS+ savvy applications hate symlinks and do unexpected things when asked to store data in a symlinked directory. So if after migrating data offline you try to add anything to those directories (for example, by ripping another Beatles album, say Let It Be in iTunes), it will end up sticking that in ~/Music/iTunes/iTunes Music/Let It Be rather than in ~/Music/iTunes/iTunes Music/Beatles/Let It Be. It still works, it’s just unpleasant. This means that you should always be prepared to undo your symlinks before installing software updates, for example, lest you confuse the poor lost little Finder.

I hope this little trick helps you, and be sure to make backups of any unrecoverable data before trying it, lest a careless slip of the fingers (or a mistake on my part!) cause data loss.