Hacker Newsnew | past | comments | ask | show | jobs | submitlogin

Genuine question, does MacOS actually care about file extensions? I would guess not, though there are probably some compatibility features that will do things if they are there.


Yes it cares. If you rename a folder to folder.app then it will change to look and "behave" like an app. Or if you change the extension of a video file to mp3 you'll loose the icon preview.

Finder does try to help with renaming and when you try to rename a file only the filename is selected and not the extension.


What you're describing is just Finder caring. Linux doesn't care at all about your file extensions but Nautilus sure does.

In GNOME for example gio handles opening files in the "correct" application by way of the MIME database in /usr/share/application/mimeapps.list and ~/.local/share/applications/mimeapps.list.


LaunchServices definitely cares about extensions. The Mac OS has a strange history with extensions (classic Macs didn't really support them, but they were still a common convention), but file extensions are more than a browser-level construct.


I was under the impression that unless a file contains some other metadata (most don't), that the extension is the way the OS chooses which app to use to open it.


Unix-based has almost always used internal metadata, and the "dot" is just another character. I thought Windows was unique in relying on the suffixes, but Wikipedia suggests MacOS inherited some form from NextSTEP.


"Unix" OSes in my experience simply don't (universally) have a way to "open this file in the correct application". It's a foreign concept. Files are just sequences of bytes, and file paths are just addresses to those bytes. The file extensions are, then, purely for the sake of the user, as there is no (standard) way to store file metadata. There are specific filesystems with these metadata extensions, but otherwise, you need to resort to commands like file and libmagic for heuristics on determining file-type.

Or just use the file suffix, which is AFAIK what all the mainstream Linux desktop environments do, through Freedesktop's MIME implementation. I don't know if it supports using metadata or file magics instead, but a quick glance shows almost every MIME definition uses file globbing.

You can check this in the files located at "/usr/share/mime/application" and "/usr/share/mime/packages" on most distros. Most (all?) definitions use a "glob pattern" to match files.


I wonder if filesystems should be designed to store the MIME type alongside the file. Web browsers get MIME types alongside the data (and they do make use of that info).


OSX does care, but classic Mac OS didn't used to. It had a separate resource fork that described what the file was, and after that you could name it anything you liked.


Yes. Take a JPEG with extension. It opens fine. Get a file with .jfif macOS doesn't know what the hell it is. Same file format, weird extension. (For some reason twitter was saving files as .jfif for a while)




Consider applying for YC's Summer 2026 batch! Applications are open till May 4

Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: