Fix Home Needs

  • Subscribe to our RSS feed.
  • Twitter
  • StumbleUpon
  • Reddit
  • Facebook
  • Digg

Friday, 28 September 2012

Restoring a lost or moved iTunes library

Posted on 16:44 by Unknown

Background

When I installed an SSD in my Macbook Pro, I had to migrate all my files to new locations because the SSD is only 128 GB and my previous HDD was about 500 GB... and it was a little more than half full. So, where do I put them? I used another 500 GB external HDD (Firewire 800) as my Time Machine backup, so now I have 3 drives total. It took about a day, but I finally got everything shuffled around. This included moving my music to the external firewire drive, and thus, also my iTunes library.

The problem

At first, iTunes insisted on keeping the music library stored on my internal drive, in my home folder, in the Music directory. I told it "no, stop that!" several times but it persisted for some reason, refusing to accept my settings of putting the music library on an external drive. Finally, I nuked the silly empty library iTunes made when it started and couldn't find any existing one in my home folder, and closed iTunes.

The solution

iTunes has a couple files in the library folder: iTunes Library.xml and iTunes Music Library.xml. I don't know why there's two, but each one contained about the same things and were 30,000+ lines in length. There's also an important iTunes Library.itl file which is a binary representation of the library, which iTunes uses as its master copy of all your song titles, playlists, metadata, etc. Remove that, and iTunes will create a new empty one in its place. Remove the xml files, and iTunes will simply re-create them upon starting or closing (from the binary file).

I first tried opening iTunes with Option+Click which allows you to choose a new library (folder containing an ITL file) when it starts. This worked fine actually, except that none of the song files could be found: the library had moved to my external drive, but iTunes still expected them in my home folder.

So, I could locate them, one-by-one, or try something else.

The solution... for realz this time

After scouring Google for some time, I was finally led to this article in the Apple knowledge base, which describes how to restore an iTunes library. Summary:

First, since that KB article doesn't cover what to do when your library has moved, I had to figure this out. I opened both of those XML files and did a search-replace for the old paths with the new file paths. It's important to have iTunes closed in this process and not open it up until we're ready.

Then I dragged the ITL file (iTunes Library.itl) to the trash. And I dragged the two XML files to the desktop. Then I started iTunes. It created a new, empty library as expected. I changed the preferences so the library existed on my external hard drive in the folder I wanted. Then I did something very counter-intuitive, according to the KB article. I clicked File -> Library -> Import Playlist. Yeah, sure... except this isn't a playlist. It's a whole library.

However counter-intuitive this may seem, it worked for me. I chose iTunes Library.xml on my desktop and it restored the whole library like a charm. Now, whenever my drive is plugged in, iTunes just works. And when it's not plugged in, iTunes warns me and I can quit without messing anything up.
Email ThisBlogThis!Share to XShare to Facebook
Posted in itunes, mac | No comments
Newer Post Older Post Home

0 comments:

Post a Comment

Subscribe to: Post Comments (Atom)

Popular Posts

  • How to take FrontRunner from Provo to SLC airport
    I see this question a lot: how do I get from Provo or Orem to the SLC International Airport entirely by train (UTA FrontRunner/Trax)? Here I...
  • Behavior-driven testing in Go with GoConvey (BDD in "golang")
    First: the built-in Go testing tools Few things bring sweeter peace to the soul than making changes to Go code, then: $ go test ... PASS ok ...
  • Automatically make a Raspberry Pi with wifi support
    Okay, I love my Raspberry Pi, but setting it up just the way I want got so involved I was afraid I couldn't do it again if I had to. So ...
  • Install PECL extensions with Homebrewed PHP on Mac OS X Mountain Lion
    I needed to use the HTTPRequest class that comes as a PECL extension to PHP. This was easier than I thought. If you followed my instructions...
  • How to set up dynamic DNS in 5 minutes
    With a dynamic DNS service (don't worry, there are free ones), you can use your domain name to point it to your home server, even if you...
  • Fix the Home and End keys on Mac OS X (Mountain Lion)
    If you use a keyboard that's not designed specifically for Macs, you probably are familiar with the annoying mapping of the Home and End...
  • How to customize your terminal prompt (with colors)
    At work, the Go projects we're working on have workspaces that get pretty deep and one of the directory names is repeated down the tree....
  • Easily get your external IP address using the terminal or command line
    I want my little Raspberry Pi to "phone home" once in a while so I know where it's at. I wanted a very simple web service that...
  • Parsing CSV with Javascript efficiently
    CSV parsing is hard. There's not a strict standard, so each implementation is a little different. And when I say CSV, I don't necess...
  • PHP output buffering on nginx
    Simple trick: if you're trying to use output buffering with PHP on nginx, and it should be working, but the whole response still comes...

Categories

  • backup
  • bdd
  • byu
  • chrome
  • cli
  • command line
  • commute
  • compile
  • cross-compile
  • csv
  • development
  • dns
  • domain name
  • fastcgi
  • fcgi
  • go
  • golang
  • homebrew
  • inkscape
  • install
  • ip
  • ip address
  • ipaddress
  • itunes
  • javascript
  • keybinding
  • linux
  • mac
  • mountain lion
  • mysql
  • nginx
  • optimization
  • osx
  • parsing
  • pecl
  • php
  • printing
  • raspberry pi
  • security
  • ssd
  • terminal
  • testing
  • transportation
  • unit tests
  • vagrant

Blog Archive

  • ►  2013 (16)
    • ►  November (1)
    • ►  October (1)
    • ►  September (2)
    • ►  August (2)
    • ►  July (3)
    • ►  June (1)
    • ►  May (1)
    • ►  April (2)
    • ►  March (2)
    • ►  February (1)
  • ▼  2012 (8)
    • ►  November (1)
    • ►  October (1)
    • ▼  September (6)
      • Restoring a lost or moved iTunes library
      • Macbook Pro runs hot with SSD and TRIM Enabler
      • Printing to BYU campus printers without extra soft...
      • Installing nginx / PHP / MySQL on Mac OS X Mountai...
      • Fix the Home and End keys on Mac OS X (Mountain Lion)
      • Pre-installed development tools in Mac OS X Mounta...
Powered by Blogger.

About Me

Unknown
View my complete profile