.mht files showing exec icon on Mac I am working on a Mac (Yosemite, OS X 10.10.5) and I have several mht files which I created on Firefox by selecting File → Save as MHT. I have already associated the files with Firefox — it opens them by default — but the files continue to show the exec icon. What I am looking for is a way to make macOS recognize the mht file extension: for eg, when a PDF file is renamed in macOS, only the name of the file is highlighted but not the extension, however when a mht file is renamed, both the name of the file and the file extension (mht) are hightlighed.

I tried browsing to Firefox -> Show Package Contents -> Contents and, since it was missing, I added mht to the Info.plist using TextEdit:

&lt;dict&gt;
    &lt;key&gt;CFBundleTypeExtensions&lt;/key&gt;
    &lt;array&gt;
        &lt;string&gt;html&lt;/string&gt;
        &lt;string&gt;htm&lt;/string&gt;
        &lt;string&gt;shtml&lt;/string&gt;
        &lt;string&gt;xht&lt;/string&gt;
        &lt;string&gt;xhtml&lt;/string&gt;
        &lt;string&gt;mht&lt;/string&gt; &lt;!-- added --&gt;
    &lt;/array&gt;
    &lt;key&gt;CFBundleTypeIconFile&lt;/key&gt;
    &lt;string&gt;document.icns&lt;/string&gt;
    &lt;key&gt;CFBundleTypeName&lt;/key&gt;
    &lt;string&gt;HTML Document&lt;/string&gt;
    &lt;key&gt;CFBundleTypeOSTypes&lt;/key&gt;
    &lt;array&gt;
        &lt;string&gt;HTML&lt;/string&gt;
    &lt;/array&gt;
    &lt;key&gt;CFBundleTypeRole&lt;/key&gt;
    &lt;string&gt;Viewer&lt;/string&gt;
&lt;/dict&gt;


This did not work. Is there any way to make macOS recognize the mht extension and associate it to the Firefox icon? Alternatively, how can I make macOS associate an icon to these files (other than manually changing the icon on each file in the Get Info window)?
In the comments, you indicated that the problem files were on an external drive. Is it formatted as FAT (or NTFS)?

These filesystems have no concept of executable files, so the system seems to assume that everything is an executable program. Don't worry, there's nothing wrong with the file.



Why does it do this? Well, it's a permissions problem.

To see the permissions on a file, you can open a terminal, type ls -ld with a space after it, drag in your file, and press Return. The first part of the output will look like this:

-rw-r--r--

So what does all this mean?

r: read  w: write  x: execute

    -        rwx     rwx     rwx
    |       └─┬─┘   └─┬─┘   └─┬─┘
additional  user    group   world
  info     perm.s   perm.s  perm.s


Try this on some file in your home folder. You should get something like rw-r--r--. Now try something on your external drive—it's probably rwxrwxrwx.

(External drives usually don't have a concept of ownership, so even on an HFS+-formatted drive you'll get the same set in each field. Edit: I tested this on a random file and it came back with rw-r--r--. Oops.)



Fixing the problem

The proper way

If the partition the file is on is formatted HFS+ (like your system disk) or any Unix filesystem (e.g. ext4, XFS), then you can use chmod. To do this, type chmod -x into a terminal, add a space, and drag in your file, just as with ls above. Hit Return, and you should be golden.

In fact, this is always worth a shot—it's safe to try on any type of filesystem. If it doesn't work, see below.

The improper way—just hiding it

On filesystems with no concept of executable files, chmod will silently fail and nothing will happen. You can still hide this by setting an icon. To do this, Get Info on a file (⌘I) and drag a .icns file onto the icon in the top left corner. (You can also just copy and paste the icon from something else—that's probably the way to go here. If you want a custom icon, read on.)

So, how do you get this mysterious .icns file?

The easiest way is simply to open an image in Preview, select everything (⌘A), and copy it (⌘C). Then you can just paste it into the corner icon (click to select it first).

But .icns images have a hidden benefit—they can display differently at different sizes. This is great for app icons, which is their main reason for existence. If you want to make your own image do this, you can do the following:



Slightly off-topic: making your own icon images behave differently at different sizes


Collect a set of images, with sizes of 64x64 up to 1024x1024. These are for Retina displays, you'll downsize them later. Put them in a folder named whatever.iconset.
Rename each of them to icon_&lt;halfwidth&gt;x&lt;halfheight&gt;@2x.png (for example, the 64px icon would be icon_32x32@2x.png).
Duplicate each icon, halve its size, and rename it icon_&lt;newwidth&gt;x&lt;newheight&gt;.png (for example, icon_32x32.png). This can be automated with a shell script, using the sips command (run man sips for more info on using it).


You'll see that if you Quick Look preview the folder, you'll see your icon, and see how it behaves at different sizes.


Convert it to a .icns with this command: iconutil --convert icns and drag in your iconset, as with the other commands.




Associating the file type with Firefox

I don't know whether your process would have worked, but you'll need to make sure the system can see the change. You do this with lsregister:

/System/Library/Frameworks/CoreServices.framework/Frameworks/LaunchServices.framework/Support/lsregister .../Firefox.app


Replace .../Firefox.app with the path to Firefox, or drag it into the terminal.