MPD and Apple Lossless on OS X
Today I noticed that loads of songs were missing from the mpd library on my Mac. It turned out they were all encoded in Apple Lossless/ALAC format, which mpd can’t play unless you build it with ffmpeg support.
Here’s how to get mpd with Apple Lossless support on a Mac running Mac OS X Lion, using the Homebrew package manager:
If it’s not installed already, grab ffmpeg:
brew install --use-gcc ffmpeg
Edit the mpd formula:
brew edit mpd
This will open the Homebrew formula for mpd in your text editor of choice. You need to add ffmpeg to the list of dependencies, like so:
depends_on 'ffmpeg'
Then, enable ffmpeg in the args list:
"--enable-ffmpeg",
The finished formula should look something like this.
Next, (re)install mpd
brew install --force mpd
If it’s your first time installing mpd, ditch that --force flag, write a config file (~/.mpdconf by default) and create the directories and files mentioned therein. Here’s my config:
music_directory "/Volumes/Music/"
playlist_directory "~/.mpd/playlists"
db_file "~/.mpd/db"
log_file "~/.mpd/mpd.log"
pid_file "~/.mpd/mpd.pid"
state_file "/.mpd/mpd.state"
auto_update "no"
audio_output {
type "osx"
name "My Mac Device"
mixer_type "software"
}
Finally, (re)start mpd and update your library:
mpd --kill
mpd
mpc update
Bingo! Apple Lossless files will now show up in your mpd client, and play without a hitch.