Tips: Delaying the start of iTunes to avoid the missing library error on macOSIf 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:
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.