Friday, 2. 05. 2008  –  Category: all, sw

OS X does a good job of tracking what applications are where and what they do. I have little idea how this works, but if I move into a new home then all the files that open in VLC still work. Great. I imagine it involves FSEvents and gobs of XML somewhere.

However the magic doesn’t touch everything. I was so bold as to move from its default home in /Applications into the Utilities subdirectory. This broke the Ctrl-Cmd-D system-wide (Cocoa-wide?) lookup box. I don’t use it that much but that irked me nonetheless.

Console logs included this:[335] ([490]): posix_spawn("/Applications/", ...): No such file or directory

Clearly something thinks it knows where the nested DictionaryPanel application should live. This thing is a launchd-managed process used by the keyboard shortcut, configured out of /System/Library/LaunchAgents/

The hoojah to tweak this does of course involve XML:

$ launchctl unload /System/Library/LaunchAgents/

$ plutil  -convert xml1 -o - /System/Library/LaunchAgents/  | perl -pe 's|/Applications/|/Applications/Utilities/|;' > /var/tmp/

$ plutil -lint /var/tmp/
/var/tmp/ OK

$ plutil -convert binary1 /var/tmp/

$ mkdir /Library/LaunchAgents-orig

$ sudo mv /System/Library/LaunchAgents/ /Library/LaunchAgents-orig && sudo cp /var/tmp/ /System/Library/LaunchAgents/

$ launchctl load /System/Library/LaunchAgents/

The last step was intended to make the change work this session, but it didn’t work. The DictionaryPanelAgent still loads but didn’t do anything until logged out and in again. I think this is something to do with launchctl domains / sessiontype. Blunder factor is high.

This violates the “don’t frig with stuff in /System” principle but I don’t know how else to solve it. The modified plist could go in /Library/LaunchAgents of course, but I’d still need to disable the system version (with launchctl unload -w) which is equally naughty. I think.

Tags: ,

Leave a Reply