Move an iTunes library to just about anywhere

Feb 06, '09 07:30:00AM

Contributed by: postrational

Hints have already been published for how to move your iTunes Library to another machine or another drive. The following hint describes a method which should allow you to move your music files to any location accessible via the Finder: another drive, a network share, etc., while maintaining all information such as play counts, playlist membership, cover art, etc. In order to do this, quit iTunes and back up your iTunes library by making a copy of these files:

~/Music/iTunes/iTunes Library
~/Music/iTunes/iTunes Music Library.xml
Move your music files to their new location. Figure out what the new location of your files is in file:// URI notation. The location will be something akin to this: I do this by dragging and dropping my music folder into an empty window in the Opera browser. Opera will perform the URL encoding for you and display the path in its location bar. This is important if you have special characters in the path, which need to be encoded (spaces become %20, for instance). There probably is a smarter way to do this.

Delete the ~/Music/iTunes/iTunes Library file and move the ~/Music/iTunes/iTunes Music Library.xml file to the Desktop. Then open the iTunes Music Library.xml file using a text editor. Run a search-and-replace in order to substitute the original file locations with the new locations. For example:

file://localhost/Users/username/Music/iTunes/iTunes%20Music/ becomes file://localhost/Volumes/SERVER_SHARE/PATH/

Now launch iTunes; it should show up with an empty library. Choose File » Library » Import Playlist, and select your newly-modified iTunes Music Library.xml file. Wait for iTunes to finish importing (this might take a while, depending on the size of your library).

Enjoy! One note of caution: you may lose your Podcast settings this way; you will need to resubscribe to podcasts afterwards. If you make a mistake, or something fails, you should be able to recover the previous iTunes state using the back up you created before you started.

This hint should be future-proof, because it's based on an official Apple Knowledge Base article.

Comments (24)


Mac OS X Hints
http://hints.macworld.com/article.php?story=20090204122516833