How do I use the `security` command-line tool to add a keychain?

Solution 1:

For some reason, the feature is hidden in the form of the -s argument to list-keychains. The other gotcha is that you need to simultaneously re-add all existing keychains. This should take care of it:

security list-keychains -s `security list-keychains | xargs` [path to keychain you want to add]