I\'m trying to get my program to automatically associate certain file extensions to be opened by it but I\'m not sure how to do that in MacOSX. I\'m not asking how to assoc
If you right click on your .app file and choose "Show package contents", there will be a folder called Contents
, and in that folder, there will be a file called info.plist
and a folder called Resources
(if any of these don't exist, create them). If you want to associate the file extension .myfileextension
with your program and you want files with that extension to have the icon contained in a file called icon.icns
, copy the file icon.icns
into the Resources
folder and add the following code to the info.plist
file right before the tag:
CFBundleTypeRole
Editor
CFBundleTypeIconFile
icon.icns
CFBundleTypeExtensions
myfileextension
CFBundleTypeName
File extension description
LSHandlerRank
Owner
The lines marked in the above code should be changed according to what properties you want the extension to have.
icon.icns
should be changed to whatever name the icon you put in the Resources
folder and you want the file extension to have is called, myfileextension
should be changed to the file extension that you want to associate with your program (without the dot), and File extension description
should be changed to the description you want the file extension to have (for example for .doc files it would be "Microsoft Word document").
Also, you can check here to see what the other values mean and if you need to change them. There are also other values listed there that you can add if you need them.