Make iTunes always ask to select library

Joined
Apr 23, 2011
Messages
84
Reaction score
0
Points
6
You can make iTunes select a library or create a new one by holding down the option button when opening iTunes. Is there a way to force iTunes to display this dialogue every time it is opened without having to hold down the option button? Many people sync their devices from the same Mac and I don't want iTunes to start syncing a device with the wrong library.
 

chscag

Well-known member
Staff member
Admin
Joined
Jan 23, 2008
Messages
65,246
Reaction score
1,834
Points
113
Location
Keller, Texas
Your Mac's Specs
2017 27" iMac, 10.5" iPad Pro, iPhone 8, iPhone 11, iPhone 12 Mini, Numerous iPods, Monterey
iTunes will always sync with the default library. So whichever one you designated as default is where it's going to do its syncing. Doesn't matter how many libraries you might have.
 

Slydude

Well-known member
Staff member
Moderator
Joined
Nov 15, 2009
Messages
17,982
Reaction score
1,396
Points
113
Location
North Louisiana, USA
Your Mac's Specs
M1 MacMini 16 GB - Sequoia, iPhone 14 Pro Max, 2015 iMac 16 GB Monterey
This should be possible with either AppleScript or Automator but I'll have to do some poking around. There was an Automator action that could be used to mimic having the option button depressed. I'll have to test things and see if that still works. Applescript should work but may take me a bit longer to work out.

In theory the script could be saved as an application with a different application button assigned for each library that would then launch iTunes.
 
OP
M
Joined
Apr 23, 2011
Messages
84
Reaction score
0
Points
6
It would be great if you could work out and explain how to do that.
 

Slydude

Well-known member
Staff member
Moderator
Joined
Nov 15, 2009
Messages
17,982
Reaction score
1,396
Points
113
Location
North Louisiana, USA
Your Mac's Specs
M1 MacMini 16 GB - Sequoia, iPhone 14 Pro Max, 2015 iMac 16 GB Monterey
I was able to cobble together something that works by modifying a snippet of code I found on the Internet. I don't think it does anything harmful to iTunes, your Mac or the space time continuum but use at your own risk. It has had limited testing

1. Launch Script Editor (you can find it using Spotlight). It should open with a new blank document,
2. Paste the following code into the new document
Code:
tell application "System Events"
	tell process "Finder"
		option key down
		tell application "iTunes" to activate
		tell application "System Events"
			tell process "Finder"
				option key up
			end tell
		end tell
	end tell
end tell
3. Click the "hammer" icon at the top of the Script Editor Window to compile and check for errors.
4. Choose Save to save the script somewhere you'll remember. In the File Format drop down choose "Application"

This script probably needs for you to have an AppleScript feature called access for Assistive Devices enabled. How you enable that varies depending upon which version of OS X you are using. You can find that information here. You'll only need to do that once.

You could make an alias of this "application" for ease of use.
 

Shop Amazon


Shop for your Apple, Mac, iPhone and other computer products on Amazon.
We are a participant in the Amazon Services LLC Associates Program, an affiliate program designed to provide a means for us to earn fees by linking to Amazon and affiliated sites.
Top