Getting audio files to play in a desktop environment is nothing difficult, but it is the case if you don’t want to install a desktop environment and just use the command line, either locally or remotely. Well, I’ve found an app called moc that allows you to play audio files and gives you a pseudo-GUI. It’s also available for many Linux distros.
You can simply install it by # pkg install moc, but you won’t be able to play some formats, especially m4a files from iTunes. This is how to get it to work:
- Install ffmpeg from pkg:
# pkg install ffmpeg
- Install moc from port tree:
# cd /usr/ports/audio/moc
# make install
Make sure that you tick ffmpeg and press Enter. If the compiling process fails, it’s probably because you have some dependencies missing, and one of them is gmake. Install this one by: # pkg install gmake
- Once you have compiled and installed it successfully, you should now be able to run it from command line by: $ mocp. There is a sample configuration file at /usr/local/share/doc/moc/config.example and you can put it at ~/.moc/config.
- If you’re like me and use both pkg and port tree, pkg would try to overwrite our compiled moc with the binary install that lacks the ffmpeg option. We can lock the package so that pkg will not try to update it:
# pkg lock moc
In the pseudo-GUI, press H for help on shortcut keys you can use. Have fun with playing music in FreeBSD!