Adding extension associations to Mac OS X


Whenever I have data that I want to save quickly in Python, I use the cPickle module to write the data to a binary *.pkl file. It’s a great module, but unfortunately the PKL extension isn’t recognized by Mac OS X. Here’s a neat little trick I found for teaching MacOS to recognize unusual/unknown extensions:

First, open Automator and save a blank Application. Right-click the application and select Show Package Contents. Navigate to Contents, and edit Info.plist in a text editor. Search for the string “CFBundleDocumentTypes” and replace everything from <key>CFBundleDocumentTypes</key><array> to </array> with the following:*

		<string>Pickle Document</string>

Save the file and you’re done!**

Now when I hit return to edit the file name, it only selects the part before the extension, rather than the whole thing. It’s a tiny change, but it will make using these files so much easier from now on!

Create new extension association and icon in SnowLeopard – Super User.

* Feel free to change the bold parts to whatever you want.

** If the *.pkl extension still isn’t recognized, move the application to another folder and then back again to update your OS’s Launch Services database.