Moving an iTunes library to a server

Here’s a little thing you may need to do sometimes. It’s actually simple to do, but all the instructions I found online when looking for info on how to do it are confusing.

All I wanted to do was copy my entire library from my home directory on my iMac to an external drive on a headless Mac Mini, which is being used as the music server. Let’s assume that file sharing is enabled. Here it is, easy as pie (make sure that you quit iTunes first):

  1. Copy the whole library into the new location. Typically, that will mean dragging the file Music/iTunes in your home directory to the new location on the other machine.
  2. Switch to the new machine.
  3. Figure out the Unix path to the new library. In my case, the location was /Volumes/MiniMax/iTunes.
  4. Delete or rename the file iTunes Library. That’s the database that iTunes stores all the track data in. (Remember that you are after working on a copy of the library so you can start again if you really mess up).
  5. Create an empty version of that file – I just used the command line: touch “/Volumes/MiniMax/iTunes/iTunes Library”
  6. Open the file iTunes Music Library.xml in a text editor. I use AquaMacs. This is a text backup of the database.
  7. Replace every occurrence of e.g. /Users/johnr/Music/iTunes (the location on the original machine) with e.g /Volumes/MiniMax/iTunes (the location on the new machine). Save the file.
  8. Open iTunes while holding down the Option key. iTunes will ask you to choose the location of its library. Browse to the folder  /Volumes/MiniMax/iTunes and click Open.

Voila! (It will take iTunes a while to import the file iTunes Music Library.xml and regenerate its database file.)

It’s not quite perfect. Smart playlists based on time won’t work (as all tracks have just been updated), and all my playlists “fell out of” my playlist folders. That was easy enough to fix though. And for all I know that could have been because I was moving the library from a 10.6 Intel machine to a 10.5 G4 machine.

Hm, and I lost some artwork.

Still, easy enough to do and it could probably be scripted to be done automatically easily enough. Something for another day.

Leave a Reply