Change file association in terminal and Clear Mac OS X's icon cache
You can edit ~/Library/Preferences/com.apple.LaunchServices.plist in a text editor after converting it to XML: plutil -convert xml1 ~/Library/Preferences/com.apple.LaunchServices.plist
Then add entries like this to the LSHandlers array:
<dict> <key>LSHandlerContentType</key> <string>com.adobe.pdf</string> <key>LSHandlerRoleAll</key> <string>net.sourceforge.skim-app.skim</string> </dict> <dict> <key>LSHandlerContentTag</key> <string>mkv</string> <key>LSHandlerContentTagClass</key> <string>public.filename-extension</string> <key>LSHandlerRoleAll</key> <string>org.videolan.vlc</string> </dict>
You can use mdls to see the UTIs of file types and something like:
osascript -e 'id of app "AppName"'
to see the bundle identifiers of applications.
You can apply changes to com.apple.LaunchServices.plist by restarting. Logging out and back in isn't enough.
Clear Mac OS X's icon cache
sudo find /private/var/folders/ -name com.apple.dock.iconcache -exec rm {} \; sudo find /private/var/folders/ -name com.apple.iconservices -exec rm -rf {} \; sudo mv /Library/Caches/com.apple.iconservices.store com.apple.ic killall Dock
















