A simple shell script that searches for and plays songs from the command line in OS X. For times when you don't want to open iTunes just to play that one song you really want to listen to.
find to search for music and
afplay to play it. It looks at the file path when searching so having the artist, album and song title in the path will help. In the screenshot above, the music files being displayed are organised like this on the hard drive:
<Artist>/<Album>/<Artist> - <Track number> <Track title>.mp3.
- Download the latest version and unzip it.
- Open the
play.shfile in a text editor and change the path of the
MUSIC_DIRvariable to wherever your music files are stored.
NOTE: To easily run the script from anywhere, you can add an alias to it in your bash profile (located at
~/.bash_profile; you can create it if it doesn't exist) like so:
If you added the alias to your shell profile, just type the following command:
play <part of artist/album/song name>
- Open Terminal and navigate to the folder where it was unzipped.
./play.sh <part of artist/album/song name>
To stop playback:
killall -TERM afplay