How do I change the icon for a type of file (by extension), for example change icon for .php files?

Well, the title says it all, but here's the situation:


I'm a developer and I work on PHP, Twig, JS, CSS files every single day. I use Sublime Text. They are plain text files, but 1) file preview in Finder (by pressing space) does not show a preview, 2) I cannot assign an icon to files by type/extension. This question is about the second part.


You can see the situation in the screenshot. I can assign icons to specific files, but not to files by extension. Know how to achieve this?

User uploaded file

MacBook Pro with Retina display, OS X El Capitan (10.11.6)

Posted on Oct 14, 2016 10:16 AM

Reply
3 replies

Oct 15, 2016 7:59 AM in response to NecmettinBegiter

NecmettinBegiter wrote:


So there is nowhere in the system where filetype - icon (and hopefully) associated application matches are held?

You can tell the OS what application to use to open those files in Get Info, and it should then assign that App's document icon to the file. But, if the App doesn't have a specific icon for that file type, it will just use its default icon which may just be a blank document. If you turn on Icon Preview, it will show PHP on the generic document for most apps I tried.


The associations are dynamically built by referencing the info.plist in the Application Bundles, but as trevoz pointed out, that cannot be edited.


To be efficient, that would have to be cached somewhere, but I don't know where that is stored; however, it is dynamically rebuilt so if you found it and changed the association, it might get reverted back when the OS decides it is time to rebuild.

This thread has been closed by the system or the community team. You may vote for any posts you find helpful, or search the Community for additional answers.

How do I change the icon for a type of file (by extension), for example change icon for .php files?

Welcome to Apple Support Community
A forum where Apple customers help each other with their products. Get started with your Apple Account.