How to stop iTunes from crashing

(Don't) stop the music

iTunes

Sudden and catastrophic failings like this are normally a result of the iTunes library file getting corrupted. iTunes maintains the library in two files: "iTunes library.itl" and "iTunes library.xml", both in /Music/iTunes.

The XML file is there as a sort of reference point and to allow compatibility with other applications, but the ITL is the one that iTunes actually uses internally, and this is the one that can get corrupted. To force iTunes to rebuild this file, you need to delete the ITL file and then move (not copy) the XML file to the desktop.

iTunes
iTunes keeps your library data in two different places, which is handy

Now start iTunes and choose File > Add to Library. Select the XML file on the desktop. iTunes will use this to create new XML and ITL files in your iTunes folder — hopefully this time without the corruption. It's a good idea to disconnect from the internet while you are doing this because otherwise your podcasts can go crazy trying to download all the episodes you already have.

Bear in mind that there are some preferences that aren't in the XML file, such as the sync settings for your iOS devices, which you'll have to redo manually.