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 ‘com.apple.quicktimeplayer com.microsoft.waveform-audio 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