If you're running a machine with external drives, it's possible that they won't be mounted when iTunes starts looking for data. AppleInsider explains how to get around this, with a simple AppleScript.
While iTunes and Photos data is generally stored on the system drive, users with especially large libraries can move them to external drives, or network shares to save limited space. Given how the macOS works, and the relative slowness of external media, an app that can't find its data complains, and asks to re-locate the library.
A very simple script, coupled with proper system configuration can be used in place of manually launching iTunes after the entire boot cycle is complete. Here's how to do it.
Configure the system to not bypass your hard work
- Select "restart."
- Before the 60-second timer expires, uncheck "reopen windows when logging back in."
Remove external drive-dependent apps from starting by themselves at launch
- Open "System Preferences" and open "Users and Groups"
- Remove apps that are giving you grief about missing data by selecting them, and hitting the - button
Write the script
- In the Utilities folder, open "Script Editor"
- In the AppleScript window, type:
Delay 10
Tell application "iTunes" to launch
Other applications can be added to the list, in the same syntax as "iTunes" above.
Make the AppleScript applet, and make it launch on start
- Still in the Script Editor, select Export from the File menu
- Change "File Format" to "Application" and hit save
- Re-open "Users and Groups"
- Add the applet you just made to your list of startup items, by hitting + and navigating to where you saved the applet.
Reboot to test.
What to do if it doesn't work
Some drives spin up faster than others. The "Delay 10" line in the script works with all the external enclosures and drives we've tested it with, but adding a few more seconds may be necessary, depending on your hardware.
32 Comments
1) Thanks, Mike Wuerthele, I run into this issue on most restarts. The funny thing is I have a lot of scripts to automate many functions and never considered this simple one.
2) May I suggest also including an Automator-based option?
3) It's beyond my ken, but it's possible to only have the app(s) run only after the drive (or network share) has been mounted, which could save a couple seconds. Even more complex, you could have it send you a notification—assuming this is a headless Mac, like in my case—if the drive isn't mounted, which means the app(s) then don't launch.
I'm not sure if the following would work via Automator, but here's an example:
Here's a link to an Apple Script for mounting an external drive:
I can imagine using this on a Logic rig that uses external drives for samples and instruments.
Yup, you can get there that way too!
I guess having Apple fix the bug in iTunes is an unthinkable solution. If you put all the iTunes bug reports end to end, they would reach from here to Jupiter. They just close the ones I file without explanation most of the time or with some stupid impractical excuse.