Matlab on El Capitan: .m files have blank icon
12 views (last 30 days)
Old and newly created .m files have a blank (generic document) icon. There is a proper icon (m.icns) in the app (at /Applications/MATLAB_R2016b.app/Contents/Resources/m.icns) and I can copy it and paste into the icon of any .m file, but I want to have it show up automatically. What's gone wrong/how do I fix this? El Capitan 10.11.6, Matlab R2016b.
Stephen Jue on 21 Jun 2017
The icon cache for Mac OS X can be corrupted, leading to Finder not showing the proper icon for files. This is unknown if it is a bug specifically with MATLAB. Refer to the following link a discussion on the Apple forums for a similar issue:
Ankita Nargundkar on 21 Jun 2017
Edited: Ankita Nargundkar on 21 Jun 2017
- Elaborate on what you mean by " copy it and paste into the icon of any .m file, but I want to have it show up automatically"?
- Is it a customized icon developed by you?
- Describe the workflow of your application with code snippets
Mason Law on 24 Sep 2017
I, too am having this issue and have not found a resolution yet. Any new information about this?
Mohammad Abdolrahmani on 24 Jul 2021
Just in case you have not yet solved this issue, I think I found the reason why matlab m files have blank icons. But fig and mat files have proper icons.
I am using Mac OS big sur. Matlab 2021a. I tried all the guidelines and instructions, all of them on the web, and none worked. As a last shot, I went to matlab app folder contents (/Applications/MATLAB_R2021a.app/Contents/Resources) and I found that in this folder, there are 3 icons called cdr.icns, m.icns, and mlapp.icns. I found one of my blank icon m files, and used command+I to open information window. I tried all the three icons above, and found that cdr and m icons are corrupted and not showing anything. I deleted the icons on the information window, and finally used mlapp.icns and it properly showed the m file icon.
So what I did was to copy/paste the mlapp.icns to desktop twice, and renamed the copies to m.icns and cdr.icns. Then I replaced the new m and cdr icons back to this folder (/Applications/MATLAB_R2021a.app/Contents/Resources). Then I used onyx (or any other apps that can reset the launch services) and reset the launch services. Rebooted the machine and wow, after several months of strugggle and search, I saw all the m files have their proper icons.
So, I think the problem was in the m.icns file itself, and replacing it with a correct icns file, should work.
Please let me know if this could solve your problem as well.