Matlab on El Capitan: .m files have blank icon

13 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.
  1 Comment
Irl Smith
Irl Smith on 25 Sep 2017
I have no new info. And I am pretty disappointed that MathWorks has no solution to this, nor to disabling the persistent question "Do you want the application “MATLAB_R2017a.app” to accept incoming network connections?". MathWorksWorks seems to have no answer to this, or other settings modification, which eliminates the question on subsequent app startups.

Sign in to comment.

Answers (4)

Stephen Jue
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:
https://discussions.apple.com/thread/6833053
  1 Comment
Irl Smith
Irl Smith on 2 Jul 2017
Edited: Irl Smith on 2 Jul 2017
Thanks for the link. I used your suggestion and also did some searches for, e.g., "rebuild icon cache", and found several good pages, the best one being Fixing blank icons. However, nothing worked, including uninstalling Matlab and reinstalling it from the MathWorks site. I still have blank icons:
The first one has an icon I inserted myself by editing the Info box by pasting in a .icon I found inside matlab.app. The second one is fine; .fig files work. The third one is how all my .m files look (except the one I manually edited), and that's what I'd like to fix. Any other suggestions? I note that XCode files can have a .m extension and I do have XCode installed. Does Apple force .m files to have a generic icon because of their possible association with XCode??

Sign in to comment.


Ankita Nargundkar
Ankita Nargundkar on 21 Jun 2017
Edited: Ankita Nargundkar on 21 Jun 2017
  1. 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"?
  2. Is it a customized icon developed by you?
  3. Describe the workflow of your application with code snippets

Mason Law
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
Mohammad Abdolrahmani on 24 Jul 2021
Hi
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.
Bests
Mohammad

Categories

Find more on Introduction to Installation and Licensing in Help Center and File Exchange

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!