Many people with large media libraries store that media on external drives or network volumes. If you do this with iTunes, and the volume is not mounted when you launch iTunes, the app will change the location for its iTunes Media folder to the default. On the Mac, that’s in your home folder; on Windows, this is inside your user folder.
This has long been a problem, because when iTunes does this, it no longer finds your media, and it adds new media into that other location. Over time, if you don’t notice this, you’ll have media in two locations, defeating the purpose of using a network volume. And, in the past, when this happened, your media would be “dead” in iTunes: each item would be proceeded by ! and iTunes would not be able to find it. This caused all sorts of problems with the integrity of media libraries.
(Interestingly, my recent tests have shown that iTunes handles this a bit better now. If you spot that it’s pointing to the wrong volume, and change it back, iTunes doesn’t populate your library with ! tracks.)
Doug Adams has created a new AppleScript applet, Launch at Login, which ensures that your network volume is mounted before iTunes launches. (Sorry, Mac only.) You set up the app by adding an alias to your network volume to a specific folder, then add Launch at Login to your Login Items (in System Preferences > Users & Groups). When you start up your Mac, Launch at Login ensures that the volume is mounted, then launches iTunes.
There’s also extra protection. Since the default setting on macOS is to reopen windows and apps that were open the last time you shut down your Mac, Launch at Login first quits iTunes if it’s open. This ensures that iTunes doesn’t store the “new” iTunes Media folder location (which could be in your home folder). Launch at Login then continues with its task of mounting the network volume, then launching iTunes.
If you use iTunes on a network volume – and with a Mac – you should use Launch at Login. And if you use a directly connected external drive for your media, and that drive doesn’t always mount reliably, you should use this applet too.
Check out this episode of The Next Track podcast, Episode #39 — Storing Media on a Network-Attached Storage Device, where Doug and I discuss using iTunes with a network-attached storage device.