Technology
 

MPD on OSX

From Music Player Daemon Community Wiki

(Redirected from Osx)

Contents

[edit] Running MPD on OSX

[edit] Prerequisites

  • A Mac
  • An internet connection

[edit] Package Managers

[edit] Macports

Macports is a packaging system for OSX based on BSD's port system. You will issue these commands from within Terminal.app or a sufficient replacement, such as iTerm.

You can install it simply by using
$sudo port install mpd
(assuming you have administrator or higher privileges). If the FLAC dependency gives you any trouble, you can use
$sudo port install mpd -flac

[edit] Fink

Fink is a package management system for OSX that utilizes the apt-get utility. Usage is similar to Darwinports.

$sudo fink install mpd...

[edit] Building from source

If you're the geeky person who likes to build from source, you can do so without any problems. You will need to download and install the Apple Developer Tools [1]. You can omit the --prefix on the ./configure step if you want. For this example, we're going to use mpd version 0.13.0.

curl http://www.musicpd.org/uploads/files/mpd-0.13.0.tar.gz -o mpd.tar.gz
open mpd.tar.gz
cd mpd-0.13.0
./configure --prefix=/usr/local
make
sudo make install

[edit] LaunchD

create a file (mpd.plist) like this one:

    <?xml version="1.0" encoding="UTF-8"?>
    <!DOCTYPE plist PUBLIC "-//Apple Computer//DTD PLIST 1.0//EN" "http://www.apple.com
    /DTDs/PropertyList-1.0.dtd">
    <plist version="1.0">
    <dict>
        <key>Debug</key>
        <false/>
        <key>inetdCompatibility</key>
        <false/>
        <key>Label</key>
        <string>org.macports.mpd</string>
        <key>OnDemand</key>
        <false/>
        <key>Program</key>
        <string>/opt/local/bin/daemondo</string>
        <key>ProgramArguments</key>
        <array>
                <string>--label=mpd</string>
                <string>--start-cmd</string>
                <string>/opt/local/bin/mpd</string>
                <string>/opt/local/etc/mpd.conf</string>
                <string>;</string>
                <string>--stop-cmd</string>
                <string>/opt/local/bin/mpd</string>
                <string>--kill</string>
                <string>/opt/local/etc/mpd.conf</string>
                <string>;</string>
        </array>
        <key>RunAtLoad</key>
        <true/>
    </dict>
    </plist>

then save it and run launchctl load mpd.plist (or sudo launchctl load mpd.plist) then mpd will be launched

If you place the mpd.plist script in /Library/LaunchDaemons it will launch again when you reboot.

you may need to install daemondo

mpd and daemondo can be installed using macports [2][3]

[edit] Applescript

launch the script editor application and copy the following lines

do shell script "/opt/local/bin/mpd /opt/local/etc/mpd.conf"

Compile it to check it works. Note that /opt/local/bin/mpd is the path for a macports installation, adjust it to your needs.

Save the script in a chosen folder and in the format field select "application", then go to the system preferences and put the application you just created in the start-up list for your user.

Now mpd should start on boot with settings given in /opt/local/etc/mpd.conf.