If Tunnelblick is not currently running, you can use the command line as follows:
open -a /Applications/Tunnelblick.app --args path-to-configuration1 path-to-configuration2 path-to-configuration3...
For example:
open -a /Applications/Tunnelblick.app --args ~/Desktop/config.tblk ~/Desktop/another-configuration.tblk
which will launch Tunnelblick and install two configurations. (The "-a" is used to ensure that the proper copy of Tunnelblick is launched; OS X sometimes launches other, incorrect copies if this is not used.)
This simulates dragging the configurations onto the Tunnelblick.app icon in a Finder window showing "/Applications".
The normal user interaction will be performed, including (for a new configuration) asking if it should be installed as a private or a shared configuration unless the configuration includes an Info.plist which specifies that the configuration should be private or shared. It will also always ask for an administrator's username/password to install or replace a configuration.
Note: To delete a configuration, you can include an entry in the configuration's Info.plist to uninstall the configuration. (In other words, you "install" a configuration with a special flag that tells Tunnelblick that the configuration should be uninstalled instead of installed. See the "TBUninstall" entry in
Info.plist for details.)
When I tried this with Tunnelblick already running, it didn't work. Instead, it just displayed the VPN Details window. That's a bug, and I will try to fix it in the source code later today or tomorrow; I will post a note to this discussion if and when I have done that. If I am able to fix the problem, the fix will be included in the next beta release which is due sometime in the next few days.
You can play around with this before I fix that problem by exiting Tunnelblick before you run the above command. You can exit Tunnelblick easily with the Terminal command
osascript -e 'quit app "Tunnelblick"'
which does not return until Tunnelblick has actually quit (which can take several seconds if Tunnelblick has to close a VPN before quitting). (If Tunnelblick is not running when you execute that command, it returns quickly, so it does no harm to always do it just before the "open" command.)
The only way to replace a configuration without causing the username/password dialog to be shown would be to replace the configuration in the locations Tunnelblick uses for installed configurations. However, the configuration would need to be in its after-installation format (see
Format), and would have to have the proper ownership and permissions on the .tblk and all of its contents, and would need to have a "shadow" copy created (with the proper ownership and permissions). That all is very complex, and would need to be done partly as the user and partly as root (using sudo or equivalent). In addition, I am about to make changes to Tunnelblick that will cause some configurations that have been replaced this way to behave incorrectly until the next time Tunnelblick is launched. I will think about a way around that problem and report back to this discussion if and when I come up with a solution.