Scrawls from Preston...

Powered by Pelican.

Wed 08 October 2008

Setting Default Apps, duti calls

I had always intended this blog to have some technical tips in the mix, but haven't written up many, so here is one.

I manage an OS X environment at a school. We installed a new phone system that could email voicemail files as WAV files, and I wanted a way to set the default application that launches when these were double clicked from iTunes to Quicktime. This sort of thing is handled by launch services and can't be manipulated by the defaults command. Andrew Mortensen (of the Radmind crew) to the rescue with a command line tool he wrote: `duti`_.

This can be called a number of way, but I wanted to run it from a login script. It has to be run as the user whose settings you want to change, but loginscripts run as root, so one needs to call the actual binary as sudo.

echo ' all' \|
sudo -u $1 /usr/local/bin/duti

Another great tip embedded in the man page for the utility is a way to get a list of all of the identifiers for launchservices:

`locate lsregister` -dump | grep '[[:space:]]uti:' | awk '{ print $2 }' | sort | uniq