OS X and system-wide default paths

If you want to change the system-wide set of paths for OS X edit the file /etc/paths. (It took me too long to find this out.)

Chirp

For some applications and tools there can be no output for a long time. When these are tailed seeing nothing is disquieting. The following Perl script will output a "chrip" every few seconds, intermixed with the log file's content. For example,
tail -F foo.log | grep bar | chirp
Save the following to /usr/local/bin/chrip
#!/usr/bin/perl -w

use strict;
use POSIX qw(strftime);

$::timeout = 5;
$::format = "%F %T";

while ( @ARGV ) {
my $arg = shift @ARGV;
if ( $arg eq "-t" ) {
$::timeout = shift @ARGV;
}
elsif ( $arg eq "-f" ) {
$::format = shift @ARGV;
}
elsif ( $arg =~ /^-/ ) {
print "usage: chirp [ -t seconds ] [ -f strftime-pattern ]\n";
exit 1;
}
}

local $SIG{ALRM} = sub {
print strftime( $::format, localtime ), " chirp\n";
alarm $::timeout;
};

alarm $::timeout;

while ( <> ) {
print strftime( $::format, localtime ), " ", $_;
}

# END

Installing mt-daapd on OS X

The following story is not pretty. I am hoping there is an easier way in the future. Until then, here is how I installed a music server on a Mac.

We have a Mac Mini that is used to hold the family's music collection. However, since this machine is also used by the kids for homework, iTunes is not always running. I finally got around to installing a DAAP server on the machine so I could expect to find the music available when I wanted it. I used brew to build and install the mt-daapd server. Assuming you have brew installed you need only run

brew install mt-daapd

However, for some reason the brew recipe did not complete the installation. This turned out to be fortuitous as I continue to want use iTunes to manage the music located in my home directory. And so I configured mt-daapd to run from within my home directory. First I created the /Users/ajg/Library/Application Support/mt-daapd directory for mt-daapd data. Then created a configuration file at /Users/ajg/Library/Application Support/mt-daapd/mt-daapd.conf containing

[general] 
web_root /usr/local/share/mt-daapd/admin-root
port 3688
admin_pw password
mp3_dir /Users/ajg/Music/iTunes/iTunes Media/Music
db_dir /Users/ajg/Library/Application Support/mt-daapd
servername Minimac Fulltime
runas nobody
extensions .mp3,.m4a,.m4p,.wav,.wma,.aiff,.ogg
logfile /Users/ajg/Library/Application Support/mt-daapd/mt-daapd.log
rescan_interval 600
process_m3u 1
scan_type 0
compress 1

Your configuration should be the same except, perhaps, for port (the default is 3689 which conflicts with iTunes), password, mp3_dir, and servername. To test the installation run the following and then open iTunes so see the "Minimac Fulltime" server.

/usr/local/sbin/mt-daapd -y -c '/Users/ajg/Library/Application Support/mt-daapd/mt-daapd.conf' -f -d 1

Once it is working, the next step is to keep it running using OS X's launchd. Create the file /Users/ajg/Library/Application Support/mt-daapd/mt-daapd.plist containing

<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<key>Label</key>
<string>mt-daapd</string>
<key>ProgramArguments</key>
<array>
<string>/usr/local/sbin/mt-daapd</string>
<string>-y</string>
<string>-c</string>
<string>/Users/ajg/Library/Application Support/mt-daapd/mt-daapd.conf</string>
</array>
<key>RunAtLoad</key>
<true/>
<key>KeepAlive</key>
<true/>
</dict>
</plist>

Install it and start the server running

launchctl load "/Users/ajg/Library/Application Support/mt-daapd/mt-daapd.plist"
launchctl start mt-daapd

I can now listen to music on any of my devices around the house; which includes a first generation iPod Touch using Simple DAAP Client. And if I need to check the server's status I can open http://localhost:3688/.

Update: A link to the FireFly Media Server at the Internet Archive.