How to get Photos to show the library selection dialog each time it runs

For some users, the most frustrating thing with Photos is its habit of always using its default library. Other equivalent apps instead invite you to choose the library to use. So why can’t Photos?

The answer is that you can change Photos’ preferences so that, when it’s opened, it asks you to select the library to use, just as if you had opened it with the Option key held down. What’s most irritating about that is the Finder window automatically closes once Photos is launching.

The command to do this in Terminal is:
defaults write com.apple.Photos IPXDefaultShowLibraryChooserOnLaunch 'true'
which sets Photos’ preference named IPXDefaultShowLibraryChooserOnLaunch to that effect. However, if you try that, you’ll discover that it only works once. When Photos launches, it promptly sets that preference back to 'false', and next time that you open the app it skips the library selection dialog again.

There doesn’t appear to be another setting in Photos’ preferences to stop that annoying behaviour. So every time that you want to launch Photos with the library selection dialog, you’ll have to run that command first. Or an easier solution is to run an AppleScript, which can run that command using
do shell script "defaults write com.apple.Photos IPXDefaultShowLibraryChooserOnLaunch 'true'"
and maybe then open Photos for you.

If you find a more permanent solution, I’ll be delighted to hear it, as will David, who asked this interesting question.