Setting up mpd + ncmpcpp + others on Windows & OSX

Recently I had been playing around with MPD (Music Player Daemon) on my two separate box (Windows + OSX) and they both work wonderfully. I am very impressed with how lightweight mpd is. In case if you are wondering, the entire concept of mpd is based on server and client architecture. So you can be assured that there is a bunch of flexibility. Imagine that all the music is controlled by mpd and you can use any client as the frontend for communicating with mpd. I, for one, had adopted ncmpcpp as my front end. The best part of mpd is that you can stream it into multiple outputs, including http stream thanks to the httpd output!

Here is the basic flow on how mpd and mpd client works:
  1. mpd runs on the server (local) with the server ip and using the default port 6600. By default it will listen and accept for any connection that attempts to communicate with that port.
  2. On the remote client, a mpd client such as ncmpcpp is run to communicate with mpd. ncmpcpp is essentially a front-end that present a graphical user interface in the terminal. Any actions (such as creating playlist, playing song, stopping song, searching song, etc.) is sent to mpd via commands. By using ncmpcpp, this routine is simplified as ncmpcpp will automatically create the command for you. If you were to use mpc, you will have to type command such as mpc play to play a song.

Just a setting example of mine. I have mpd running on my Window 7 box and my OSX box running ncmpcpp to control mpd.

Part 1 - Setting up MPD on Windows

Step 1 - Installing mpd

1) Let get the balls rolling by installing mpd on Windows. Download the file at Sourceforge here.

2) Extract it to a convenient path, such as "C:\mpd". This path is used for the config file. 

Step 2 - Setting up the file path and basic attribute for mpd

1) You should see a config file with the name "mpdconf.example". Copy and paste it under the same folder, name it as "mpd.conf".

2) Open it (mpd.conf) up with your favorite text editor (mine is Notepad++) and change the following lines according to your setup. I am using the path c:/mpd. This will take care of the file that is used by mpd.

NOTE: Make sure you use the forward slash '/' instead of '\' when inserting the path.

music_directory "c:/music"
* This is your music directory. It is possible to include multiple music directory, but it is only achievable by using symlink. I'm not sure how to achieve it with Windows.

playlist_directory "c:/mpd/playlists"
* The playlist that you created via mpd client will be saved here.

db_file "c:/mpd/db"
* This will store your music database. You can view it using any text editor as it is stored in plain text.

log_file "c:/mpd/log"
* The log file that keep the events logged.

pid_file "c:/mpd/pid"

state_file "c:/mpd/state"

sticker_file "c:/mpd/sticker"


3) You can change the default port on which mpd is running (6600). Do this by uncommenting the port line and change the number to a number other than 6600.

port "6666"

Step 3 - Configuring audio output

1) Don't close that text editor just yet. In case if you are wondering, we haven't configure the audio output yet. Go to the Audio Output section (by searching for the term 'audio output'), it is at the mid section.

Copy and paste the following code:
audio_output {
  type "winmm"
  name "Speakers"
  device "Speakers (Realtek High Definition Audio)"
# You might need to change this if you are using another type of sound card. I am using the built-in soundcard of Asus Sabertooth x58. You can check this by right clicking at the Volume icon at your taskbar, and select Playback devices.


2) Uncomment the following code if you plan to output the stream via http. By doing so you can open any media player such as VLC or iTunes to playback the stream.

audio_output {
    type        "httpd"
    name        "My HTTP Stream"
    encoder        "vorbis"        # optional, vorbis or lame
    port        "8000"
    bind_to_address    ""        # optional, IPv4 or IPv6
    #quality        "5.0"            # do not define if bitrate is defined
    bitrate        "128"            # do not define if quality is defined
    format        "44100:16:1"
    max_clients    "0"            # optional 0=no limit

NOTE: If you are behind a firewall, make sure you allow port 8000 (the default port).

3) If you are using PulseAudio server, uncomment the following lines:

audio_output {
    type        "pulse"
    name        "My Pulse Output"
#    server        "remote_server"        # optional
#    sink        "remote_server_sink"    # optional

Save the file.

Step 3 - Running mpd.exe

1) Now open up the command prompt and launch the mpd!

cd c:\mpd

You will need to supply a parameter for the config file to mpd.exe. Since we placed it under the same folder as mpd.exe, we simply enter:

mpd mpd.conf

2) Just leave the window running and you should see a process name mpd.exe spawn under the Processes in your Windows Task Manager.

Part 2 - Installing ncmpcpp on OSX

Step 1 - Installing and configuring ncmpcpp

1) If you are using any port such as Mac Ports, you can simply install ncmpcpp by entering the following line into the terminal:

sudo port install ncmpcpp

2) By default, the binary is located at /opt/local/bin/ncmpcpp.

3) Go to /opt/local/share/doc/ncmpcpp and copy the config file into a folder called .ncmpcpp under your home directory.

mkdir ~/.ncmpcpp
cp /opt/local/share/doc/ncmpcpp ~/.ncmpcpp

4) Go to ~/.ncmpcpp and open it with your text editor.

nano ~/.ncmpcpp/config

5) Uncomment the line mpd_host and change it into the IP address of the host running mpd.

mpd_host = ""

Change the mpd_port if you configure your mpd to run on a different port other than the default 6600.

6) Save.

Step 2 - Running ncmpcpp

1) To run ncmpcpp, simply type ncmpcpp into your terminal.



Part 3 - Installing mpc

1) Just like ncmpcpp, mpc is available on Mac Ports as well.

sudo port install mpc

2) Run it by typing mpc into the terminal.


Part 4 - HTTP Streaming

1) Since we had already setup our mpd for http streaming output, just open any of your favorite music player such as VLC and open the network stream.

Cmd + N >

Troubleshooting mpd

There are some commands that you can sent to mpd to probe its status such as:

# Checking the list of output that mpd is currently using

mpc -h [server ip] -outputs


MPD Wikia


Great tutorial! Thanks a lot


Thank you for share!
I installed the server as you show so I could use MPDroid in my mobile to play sounds. I try to use winamp but it does not work.


When running mpd.exe with the conf file, it says the database didn't exist, so i made an empty one, but now it says its corrupted.
i can't use "mpd update" because i cant specify the file, and "mpd mpd.conf update" won't work because it has "to many arguments"


Surprised the windows mpd server worked the first time I tried it. Thanks for the guide!


Post a Comment

If you found this article or post helpful to you, feel free to enter your comments below ;)