Take the 2-minute tour ×
Ask Different is a question and answer site for power users of Apple hardware and software. It's 100% free, no registration required.

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?

share|improve this question
add comment

1 Answer

up vote 9 down vote accepted

You can use the "Automatically Add to iTunes" folder for that (see HT3832):

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
share|improve this answer
    
Works a treat. Thanks! –  halloleo Apr 20 '13 at 2:19
    
You should use mv instead of cp so that the file is added and you are not left with a duplicate song file outside of your iTunes library. –  CyberSkull Apr 28 '13 at 23:11
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.