Moving an iTunes Library … Correctly

It’s easy sometimes to overestimate the intuitiveness of OS X and it’s bundled applications. Case in point, I moved my iTunes library when I purchased my Time Capsule. Due to my smaller Macbook hard drive, I wanted to move my library to free up space.

And I did so without reading any instructions or Googling. I figured I was familiar enough with the tools and the concept wasn’t that complicated. So I updated the iTunes Music folder location setting under Preferences – Advanced – General tab in iTunes. Then I closed iTunes and moved all the music to the specifed folder on my Times Capsule. Done.

Oops

Turns out a lot of people make this same mistake. Now this method can sometimes just happen to work out. But, as I can attest to, it most often does not. The problems I had were this: many times I would open iTunes and every song in the library would have the little exclamation mark next to it, meaning that iTunes could not find the file.

I could still use iTunes in this state—when trying to play a song, the application will ask for the location. After you locate the file in it’s new home, iTunes will update the rest of the library. But that takes time, and it didn’t take long before doing that a couple times a week got old.

So I finally went about fixing the issue, and thought I would share my findings. It seems a common enough problem that others might be interested.

Resrouces

Here are a few articles that I used. The first is Apple’s official instructions on how to correctly move your library. The second and third give the same instructions and also explain how iTunes manages your content.

Of course, none of this was helpful to me after the fact—I’d already buggered up my library. But I happened upon the site of Paul Beard where he has a tutorial on how to fix a library.

Summary

Please feel free to get all the details from the links above, but I thought I would summarize as well.

The issue I had created was this—by not using the Consolidate Library option in the Advanced menu in iTunes, I had moved the files, but had not updated the path that is included in the iTunes library file.

In your iTunes setup there are two files: iTunes Library, which is the binary file that iTunes uses when running, and iTunes Music Library.xml, which is a backup in case anything happens to the first file.

In the screenshots below you can see how these files store the path for the library. They also store the path for every content file in your library—songs, podcasts, movies etc.

Old setting:

New setting:

So following Mr. Beard’s tutorial, I kept these files in their default location under my user directory, but I did a find and replace within the backup xml file for every instance of the path, adding the new location. The I opened the binary file using an app named Hex Fiend and deleted all the contents. In essence, you break the binary file.

The next time iTunes opens, it rebuilds that binary file based on the contents of the backup xml file.


This worked well and my library now works correctly. But the best option—take my advice on this—would be to move it correctly the first time.

Don’t be like me—read the instructions.