From the terminal, how can I disable iTunes from running when a device is connected?
You should be able to run this command in terminal, then restart iTunes:

defaults write com.apple.iTunesHelper ignore-devices 1