Many people have music in two iTunes libraries, on two different computers, and eventually decide they want to combine or merge those libraries. Here’s how to do it.
First, some background. iTunes stores your music and other media, and maintains several files that contain information about this content. They’re found in ~/Music/iTunes/ (~ is a shortcut for your home folder, the one with the house icon and your user name):
The main library file is iTunes Library.itl. The iTunes Library.xml file is one that you can use to import a library; iTunes writes that file in easily readable format so other apps can get a list of your iTunes library content.
So, let’s assume you have Library A and Library B, and you want to add the contents of Library B to Library A. Do nothing to Library A, but find the content of Library B – presumably on another disk or computer – and copy it to the computer containing Library A.
You’ll have an iTunes Media folder, which contains all your content – music, videos, apps, etc. – and you’ll have the files you saw above. To make sure all your content is in that iTunes Media folder, choose File > Library > Organize Library, check Consolidate Files, then click OK. If you have a lot of files that are not in the iTunes Media folder, this may take a few minutes.
Next, drag the iTunes Media folder into iTunes. But first, create a new playlist; name it anything you want, such as Library B, or Temp. Switch to that playlist in iTunes, then drag the iTunes Media folder to that playlist. It will be useful to have a record of the content you’ve added to your iTunes library in case you can’t find something later.
Next, in iTunes, choose File > Library > Import Playlist and choose the iTunes Library.xml file you copied from Library B. This will add all the contents you just dragged into iTunes, but will also add the playlists from that library. Unfortunately, this won’t retain things like play counts, ratings, etc.
Now you’ll have an iTunes library with playlists and content from two different iTunes libraries. However, there’s a chance you’ll have duplicates of some of your media files. For things like Movies and TV shows, it’s easy to find these manually; just delete one copy. But for music, if you have a large library, it can be difficult.
iTunes can show you duplicates. When you’re in your Music library, press the Option (ALT) key, then choose View > Show Exact Duplicate Items. If there aren’t too many, you can go through the list and delete the duplicates manually. If there are a lot, I recommend using Doug Adams’ Dupin, which offers powerful options for finding and deleting duplicates.
You’ll also want to check for duplicate playlists. If you still have the default smart playlists that iTunes creates – Recently Played, Recently Added, etc. – they may show up twice. Since they’re smart playlists with the same conditions (if you haven’t changed them), each of the duplicates will contain the same content. You can delete one of each.
Once you’ve completed this process, you’ll have merged your two iTunes libraries. You can delete the temporary playlist you created.