Desired result:

All .py files show a nice Python icon, regardless of what default program they opened with. (Same for .cpp files, .txt files, etc)


How it currently works:

Files (ex: .py files) are associated with their default program (in my case, Sublime text editor). The program (Sublime) then gets to choose what icon to show. It is possible to manually edit the program's (Sublime's) code to change the icons.

Details: https://superuser.com/questions/178316/how-to-set-an-icon-for-a-file-type-on-mac

(I have done this with Sublime)


Why this result is not enough:

I recently switched to the Atom text editor which broke all the icons I had setup in Sublime. In addition, I can't change the icons for Atom like I did in Sublime. The Atom editor's plist file and resources folder is not setup like Sublime. (It is still possible, but rather than renaming/replacing things, Atom actually requires additional code to be written/modified, and I don't have the skill/knowledge to just write the necessary code, and I cannot find any tutorial for learning how)

I (and I believe many others) would prefer that the file icon was set independently from what the default program is. (I mean an Excel file should look like an Excel file whether or not I open it with Microsoft Excel, Numbers, or Sublime)


Possible solution:

It might be possible to fix this with an opener-app. If an opener-app is made the default opener for all file extensions, it would be able to set the icon for all those extensions. Then when the opener-app opens a file (for example .py file) it could then open that file with another program (for example Sublime). This way the default program could be changed through the opener-app, (for example, changing the opener-app to have all .py files open the Atom Editor) but, because the opener-app is still technically the default, all the file-icons remain unchanged.



Does anyone know of an app that does this already?

(If you know of any resources on how to create an app like this, I'd be happy to use them to make the app myself, and post the answer here)

  • What version of OS X/macOS are you using? Commented Apr 23, 2017 at 18:15
  • OS X Sierra, 10.12.4
    – Jeff Hykin
    Commented Apr 26, 2017 at 21:41

1 Answer 1


(note, this appears not to work as of MacOS Big Sur v11.1 )

I was able to hack together an app that does this. I created a repo explaining it here

You can download the app using the download button on this page

You can change the icons for existing file types. The only code I had to write for it was the following applescript:

on open this_item
    tell application "Visual Studio Code"
        open this_item
    end tell
end open

Setup For yourself

Open script editor (a built-in Mac app)

Choose File -> Open -> where ever you downloaded the app

You will then be viewing the grand total of 5 lines of code I wrote. Change "Visual Studio Code" to whatever app you want to be your default.

Save the file (command + s).

Move the app to your applications folder.

Find a file you want to change the icon of (lets say a text file). Click the file once (highlight it), press command + i, go to the open with section. Choose DefaultOpener from the list, then click change all.

You will probably have to reboot and toggle the show icon preview button (found in Finder's View Options) a few times for the icons to refresh and get replaced.

I have a few default icons already loaded up ( Text files, cpp files, bash/shell files, python, and about 7 others), but if you want to add your own:

  • Open your applications folder
  • Right click on DefaultOpener
  • Choose show package content
  • Then open the content folder
  • Then open the resources folder
  • Then replace whatever icon with your own icon! (Note your replacement icon will need to be a .icns file)
  • Restart and toggle the show icon preview button a few times
  • List item

Edit: All of the sublime code referenced in an earlier answer has been fully removed from the app

  • I do not believe Sublime HQ Pty Ltd, would appreciate you redistributing their copyrighted intellectual property, packaged in your app! Commented Apr 26, 2017 at 23:06
  • You're right, and if I get any complains I will certainly take it down. I love the Sublime editor and wouldn't want to do anything that would reduce it's value. That said the files I have included are not unique to Sublime, in fact every Mac app that can open a file has nearly identical files. It just happens that I had already modified the Sublime files. There is also no mention of copy right inside any of the files I included (and there is mention of copy right other Sublime files).
    – Jeff Hykin
    Commented Apr 27, 2017 at 19:54
  • This Google link is now broken. Would be nice to know what the AppleScript was.
    – benwiggy
    Commented Jul 23, 2020 at 9:42
  • Man this is old. Anyways, I went and created a github repo for it here The readme explain's where to see the 5-line applescript file, and I'll edit it into the answer.
    – Jeff Hykin
    Commented Jul 23, 2020 at 14:57
  • 1
    @JeffHykin I have come up with my own answer here, using a dummy app created in Xcode. apple.stackexchange.com/questions/396740/…
    – benwiggy
    Commented Jul 23, 2020 at 15:23

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .