ax1wqa
Last Updated: February 25, 2016
·
2.857K
· mateuszgachowski

iTunes Command Line Interface

If sometimes your Mac Multimedia Controls are not enough, and you don't want to change application scope or pause your work, iTunes CLI is the best way to do some basic stuff from your terminal.

Example usage:
itunes start - Starts iTunes if not yet started

itunes status - Shows iTunes' status, current artist, track and all tracks in current playlist.

itunes pause - Pause music

itunes play - Unpause music

itunes prev/next - Goes to previous/next song in the playlist

itunes mute/unmute - Nothing to say here :)

itunes vol <val> - Sets the volume to given value (0-100%)

itunes albums - Shows the full list of albums (takes some time)

itunes search - Plays given album, e.g.

itunes search 'Once Again'
# Playing Barclay James Harvest - Once Again
itunes search 'Pawn'
# Playing Van der Graaf Generator - Pawn Hearts
# etc...

itunes stop - Stops music

itunes quit - Quits the player

To use the script, you have to save it in a file and then include in the .bash_profile(Mac) / .bashrc(Linux) file.

Source file: https://gist.github.com/mateuszgachowski-snippets/7833114

cd ~
mkdir .termscripts
cd .termscripts
mkdir .itunes
cd .itunes
curl -O https://gist.github.com/mateuszgachowski-snippets/7833114/raw/302f866ce25de20a65ecd8d6491132cb23d661d8/itunes.sh

vim ~/.bash_profile
# iTunes
alias itunes='~/.termscripts/itunes/itunes.sh'
## save the file
source ~/.bash_profile

From now your itunes command should be available everywhere ;)

That's all, I hope that helps!

1 Response
Add your response

13362

looking to get this working in mavericks getting this error:

jimbmacbookpro:.itunes root# itunes pause

Pausing iTunes.

29:34: execution error: An error of type -10810 has occurred. (-10810)

any advice?

over 1 year ago ·