Introduction
This works for me on MacOS X Server (10.3 and 10.4), (and has done so since much earlier versions of mt-daapd) - I see no reason why it wouldn't work properly on the client version of Mac OS X, although I haven't tried it.
(I can confirm that the MacPorts instructions work on the regular, client Mac OS X.)
Installation
Using MacPorts
- sudo port install mt-daapd
- copy /opt/local/etc/mt-daapd.conf.sample to /etc/mt-daapd.conf and edit
- optionally to the same with /opt/local/etc/mt-daapd.playlist.sample
- rehash if you use csh
- sudo mt-daapd
Using Fink
Download and Build
- Have a look at the latest version of mt-daapd and notes at: mt-daapd.org then follow the links to download the tarball from sourceforge.
Install Mac OS X developper tools if you haven't got them installed already. They are downloadable from the Apple site here (http://developer.apple.com/tools/xcode/index.html).
Download and install fink (http://fink.sourceforge.net/download/index.php)
Then FinkCommander (http://finkcommander.sourceforge.net/#download)...
- Run fink Commander and update package descriptions (will go through initial config steps)
- Find libid3tag and install (I used the binary)
- Find gdbm3 and install (again, I used the binary.)
- From the command line, cd into the directory of the unstuffed tarball (from #1)
- Run : ./configure (I ran this as root)
***** Use this command to tell where the libraries are installed!!! *****
./configure --with-id3tag=/sw --with-gdbm-includes=/sw/includes --with-gdbm-libs=/sw/lib
- Run : make ('sudo make' if you are not root)
- Run : make install (this doesn't seem to copy all the files as required... hmmm) ('sudo make install' if you are not root)
Configure
- Create an mt-daapd dir in /etc/ then copy files from the tarball dir:
# mkdir /etc/mt-daapd # cp contrib/mt-daapd.conf /etc/mt-daapd/ # cp contrib/mt-daapd.playlist /etc/mt-daapd/
- Edit the config file at /etc/mt-daapd/mt-daapd.conf The important bits (all others default):
# the location for the db files
db_dir /var/cache/mt-daapd
# change the freakin' default password
admin_pw put_top_secret_admin_pass_here
# put whatever directory you want here. No trailing slash and no spaces! (no you can't use backslashes to make this work!)
mp3_dir /musique
# Set the servername for Rendezvous/Bonjour
servername musique
# You will likely need to change the location of the admin web pages, especially if you receive an error message about web root
web_root /usr/local/share/mt-daapd/admin-root
# Be sure to change runas to your preferred user
runas User
- Create a directory for the DB files as specified in the config file (or set the pref to an existing dir). Mt-daapd will not run if the dir doesn't exist (i.e. it will not create the dir if its not there)
- Copy music to the proper place...
Startup item for Mac OS X: (goes in /Library/StartupItems/mt-daapd/) There are three things in here: a) a resources folder (with localization files) b) StartupParameters.plist and c) the mt-daapd startup script
- In the Resources folder you can create a folder for your localization of mt-daapd (ex. English.lproj, French.lprog etc.). Inside the lproj folder is a file called Localizable.strings. Here's what's inside:
<?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>Starting mt-daapd</key>
<string>Démarrage de mt-daapdL</string>
<key>Stopping mt-daapd</key>
<string>ArrĂȘt de mt-daapdL</string>
</dict>
</plist>
Note that it is UTF encoded, so you would be best served using an editor like pico that can handle UTF.
Here's the guts of the StartupParameters.plist:
{
Description = "mt-daapd iTunes server";
Provides = ("mt-daapd");
Requires = ("Resolver", "Disks");
OrderPreference = "Last";
Messages =
{
start = "Starting mt-daapd";
stop = "Stopping mt-daapd";
};
}
and here's the startup script:
#!/bin/sh
. /etc/rc.common
StartService ()
{
ConsoleMessage "Starting mt-daapd"
/usr/local/sbin/mt-daapd -c /etc/mt-daapd/mt-daapd.conf
}
StopService ()
{
ConsoleMessage "Stopping mt-daapd"
killall mt-daapd
}
RestartService ()
{
StopService
StartService
}
RunService "$1"
The mt-daapd script will have to have execute permissions on it, so chmod 700 it so that it will execute. Note that at startup, this script is executed as root, then it switches to the user noted in the config file.
If you want to start from the command line, you will have to use this command: sudo /Library/StartupItems/mt-daapd/mt-daapd start
In my situation, I wanted to be able to share a school's CD collection (that was gatherg dust in the library) to all the students via iTunes. For ease of management, I created a network user to manage the import process then specified their iTunes music folder in the mt-daapd config file. This is also the user that is specified in the runas command (so permissions are already OK). If we want to add more music to the shared library, all we have to do is log in with the music account, then use iTunes to import new CDs. Dead easy for the user that has to do it (i.e. not me!)
There you have it....
If you are running 10.4 the preferred method of starting a daemon is with launchd. An easy way of creating a plist file and installing it, is using lingon (http://lingon.sourceforge.net/). If you really really want to use launchtl and install the service by yourself, here's my plist file:
<?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>Label</key>
<string>nl.ikkanalles.mtDaapd</string>
<key>ProgramArguments</key>
<array>
<string>/usr/local/sbin/mt-daapd</string>
<string>-c</string>
<string>/etc/mt-daapd/mt-daapd.conf</string>
</array>
<key>RunAtLoad</key>
<true/>
<key>StandardErrorPath</key>
<string>/var/log/mt-daapd/error.log</string>
<key>StandardOutPath</key>
<string>/var/log/mt-daapd/out.log</string>
</dict>
</plist>
you can load the plist by issueing:
launchtl load /path/to/file.plist
... the Media Server.