How to stream radio from the command line?

While not (strictly speaking) playing from the command line, you could use a set of AppleScripts (or AppleScript calls) wrapped in shell scripts to control a GUI player or website. In the likely case that the player or site doesn't directly support AppleScriptability, you can use AppleScript GUI scripting to control the mouse and keyboard.

If you're looking at a "normal" streaming radio station (i.e, one that has a downloadable file that specifies the stream), you can put that in iTunes and use its (relatively excellent) AppleScript dictionary to remotely control it.

With either option, if you want to get fancy, you can use remote scripting to send Apple Events from an arbitrary source machine to control your radio-iMac.


You can run VLC to play a stream from the command line:

/Applications/VLC.app/Contents/MacOS/VLC <address>

For example this (address from here) will play BBC Radio 3:

/Applications/VLC.app/Contents/MacOS/VLC http://a.files.bbci.co.uk/media/live/manifesto/audio/simulcast/hls/uk/sbr_high/ak/bbc_radio_three.m3u8

To stop playing, press or send Ctrl+C.

For more information on the command line interface see here and the pages linked from it.