How to Migrate iTunes from Windows to the Mac

September 7th, 2008

I recently switched from Windows to the Mac at home, and was unable to find a comprehensive guide to migrating iTunes from Windows to the Mac. This post attempts to help fill that gap.

To follow this guide you should be comfortable using the Windows and Mac operating systems and a text editor. I recommend reading all the way through the instructions before beginning.

1. Run iTunes

First, run iTunes on the Mac. This should create a default iTunes folder structure in your home directory, at ~/Music/iTunes. When you first run iTunes it may ask if you want to scan your hard drive for music; do not allow iTunes to do this. It may also ask if you want iTunes to keep your music organized for you. Make sure you select the setting that matches your Windows iTunes configuration; you may need to edit the iTunes Advanced preferences to do so.

Now that you’ve gotten the initial iTunes configuration set up, quit iTunes before proceeding.

2. Copy Music Files

Next you need to copy your music files from Windows to the Mac. I recommend that you use an external hard drive to do this. Do not use a network connection to copy the files; as of this writing there is a bug in the Mac Samba implementation that causes some remote Windows directories to appear empty when they are not.

You may have configured your Windows installation of iTunes so that it didn’t organize your files for you. This is usually the case if you were using another system to organize your MP3 files prior to adopting iTunes. In that case, you may have an extra folder (for example, D:\MP3) on your Windows machine that contains much of your music. You’ll want to copy that folder to your Mac home directory; I recommend ~/Music/MP3.

Whether or not you let iTunes organize your music on Windows, iTunes always organizes your purchased music for you. Therefore you will need to copy your Windows folder My Documents\My Music\iTunes Music\ to your Mac as ~/Music/iTunes/iTunes Music.

3. Copy and edit iTunes Music Library.xml

Fortunately for us the Apple engineers used XML for the iTunes database. This means that the same file format works on both Windows and the Mac, and we can edit the file to tell iTunes about the new file locations.

Before you copy the file iTunes Music Library.xml to your Mac, I recommend that you make a backup copy of that file in case you discover later that you didn’t mean to overwrite it.

Using your favorite Mac text editor (such as TextEdit, BBEdit, or Emacs), edit the file iTunes Music Library.xml. Search and replace all of the file locations; for example, if your username on windows is Robert and your username on the Mac is Bob, you may need to change all occurrences of the string “file://C:/Documents%20and%20Settings/Robert/My%20Documents/My%20Music” to “file://localhost/Users/Bob/Music/”. If you didn’t let iTunes manage your files on Windows you will need to do another search and replace (for example, to change “D:\MP3″ to the corresponding new location you chose on the Mac).

Before proceeding to the next step, make a duplicate of your newly edited file. If you make a mistake in the next step iTunes will overwrite the file iTunes Music Library.xml, so you’ll want to have a backup on hand in case that happens.

4. Create an empty iTunes Libary file

iTunes really uses the binary file iTunes Library as the database file for your music. However, iTunes will fall back on the XML file when it discovers that the binary file is empty. Unfortunately it does not do this if the file iTunes Library is missing or merely corrupt; in those cases it will delete your old XML file and create an entirely new and empty database. Therefore make sure you have a backup copy of your XML file from the previous step before proceeding.

Run the Mac Terminal app, and type the following command in the shell:

cat /dev/null > ~/Music/iTunes/iTunes\ Library

This will replace the file ~/Music/iTunes/iTunes Library with an empty file by that name.

5. Run iTunes

Finally, run iTunes. If everything has worked correctly, iTunes will rebuild its database from the XML file and you will be done. If some of your music is missing you probably made a mistake in step three and you’ll need to go back to that step and try again. If all of your music is missing, you probaby made a mistake in step four and you’ll need to restore the backup copy of your edited XML file and start with step four again.

Share this Post

del.icio.us Digg Reddit Technorati Help

The Rainier Ruler

April 29th, 2008

Mount Rainier can often be seen from many places in Seattle, and the two locations are about about 100 kilometers apart. This makes it a nice measuring stick to help Seattleites envision relative distances.

Rainier from Seattle

Read the rest of this entry »

Book Review: The Algebraist

April 15th, 2008

The Algebraist

Published in 2004, this fun, fast-paced modern space opera is vast in scope. It tells the story of how a single human, Fassin Taak, begins to change an ancient balance of power between two galactic civilizations. The multi-billion-year-old galaxy-wide post-civilization of long-lived gas giant dwellers is rumored to own a secret vast network of wormholes, and the nearly galaxy-wide civilization of “quick” species (which includes humans) wants in on the secret. Seer Taak is a kind of emissary to (and explorer of) the Dwellers, and his mission is to find the key to their secret wormhole list in time to summon defenses for an impending invasion of his home world. His exciting adventure is filled with twists, turns, and interesting details about the Dweller world Nasqueron (where most of the action takes place).

Read the rest of this entry »

Announcing NaFiMaBa 2008 (National Find Matt Baldwin 2008)

April 6th, 2008

As part of my contribution to the interweb’s effort at locating Matt, who hasn’t posted a topic on Defective Yeti for an alarming nineteen days, I’m setting up a user-aided search tool similar to the one that unfortunately failed to find Steve Fossett. Instead of searching satellite photos of the desert, we’ll be searching through snapshots of board game stores. However, this is a low-budget effort, so I only have one photo so far (of First Pick Games on Stoneway in Seattle). If you spot Matt in the photo, let us know!

Read the rest of this entry »

Book Review: Cold Mountain

March 13th, 2008

Read the rest of this entry »

Seattle Winter Haiku

January 10th, 2008

Crows on gray branches
Eye each other from afar
Trash dumpster detente

Share this Post

del.icio.us Digg Reddit Technorati Help

Step on a Crack, Get Eaten

September 26th, 2007

Everybody knows the old children’s rhyme “step on a crack, break your mother’s back.”

I haven’t met anyone who didn’t play that game as a child. Some people with OCD are unfortunately even driven to play that game continuously. So where does this desire come from?

Read the rest of this entry »

How to Internationalize Your WordPress Plugin

August 31st, 2007

If you’re a WordPress plugin author, you can reach a wider audience by providing translations of your plugin in languages other than English. For step-by-step instructions on how to do that, read on.

Read the rest of this entry »

The Quick Hang-Up Mystery

July 31st, 2007

Do you speak a language other than English? If so, you might be able to solve a mystery. Read on to find out more.

Read the rest of this entry »

16 Reasons to Meditate Every Day

June 25th, 2007

Anyone who has spent more than five minutes on the Web knows that it provides access to a huge amount of information, some of which is even accurate. However, despite the fact that you can learn much by reading, there are still some things that you can only grok through experience. After reading yet another article about the benefits of meditation, and realizing that I spend way too much time learning by reading newsfeeds and social news networking sites instead of by experiencing things directly, I decided it was time to experience meditation.

Read the rest of this entry »