Adding a song file to iTunes via the command line without playing the file I want to add song files to iTunes via the command line. 

    open -a iTunes -g song.mp3


does exactly this. - However it starts playing the song, too. Any way to avoid this?
You can use the "Automatically Add to iTunes" folder for that (see PH19617):

cp song.mp3 ~/"Music/iTunes/iTunes Media/Automatically Add to iTunes/"


If iTunes is running, anything you copy into this folder will be imported into iTunes automatically (and deleted from the folder afterwards).

Please note:


The folder name might be language specific, so check the name on your system first.
Depending on when iTunes was installed, the media folder may be called either iTunes Media or Tunes Music