3

Developing an iOS apps, there was a thing that drove me mad: executing the same app that created the same files at the same path, the iPhone simulator worked the correct way, while a real iPhone didn't. I eventually discovered that i mistyped a character (uppercase instead of lowercase) and consequently the iPhone created a folder starting with an uppercase character, while putting the file in a path with that folder starting with the lowercase version of that character. The simulator however, didn't care of that difference. I suppose that was because the simulator, running on a case-insensitive system (OS X/mac OS), inherits its "case-insensitivity", while the iPhone (seems to me) is natively case-sensitive.

Is there any known explanation/documentation by Apple (or other trusted sources) on why the iOS filesystem is case-sensitive, given that is an OS based on a case-insensitive one (OS X)?

3
  • 1
    I think at the moment iOS and MacOS use different file systems. Eventually both will presumably use APFS. There is some info in the Implementation section of developer.apple.com/library/content/documentation/… May 26, 2017 at 1:30
  • 4
    The better question is "why is macOS case-insensitive?" Every Darwin-based OS aside from macOS used HFSX (Mac OS Extended, Case-Sensitive) while macOS uses HFS+ (Mac OS Extended). While there's no official "reason" as to why, it was likely done to maintain compatibility with HFS systems when Apple transitioned to HFS+. AFAIK this will continue with APFS as Apple appears to have introduced a case-insensitive variant of APFS in March of this year.
    – Geoff
    May 26, 2017 at 7:26
  • So the case-sensitivity of a system resides exclusively on the file system in use? If "for example" I would format in HFS+ a partition in a Linux environment, using that partition from the console will have a case-insensitive behavior like macOS?
    – mars
    May 26, 2017 at 11:50

2 Answers 2

3

HFS+ originally ran on System 8 and System 9 and is case-insensitive. Apple developed the HFSX case sensitive file system around 2002-2003 as a replacement for UFS which was used by NextSTEP and could also be used by OS X.

In the transition from System 9 to OS X, Apple offered Carbon API's so that vendors could easily port their products without completely re-writing their applications. Carbon does not offer case sensitivity. For many years major vendors used Carbon code in their products, so HFS+ was left as the default file system.

iOS has transitioned to APFS but TimeMachine uses HFSX.

2
  • So iOS devices didn't have to support backwards compatibility and adopted a case-sensitive file system, while OS X sticked with a Carbon-compatible file system? So the decision was a sort of forced one, not a preference for a case-insensitive system, am I right? However I've read it's possible to install OS X with "case-sensitive HFS+". Wouldn't that break any compatibility with "Carbon-ported" applications?
    – mars
    May 26, 2017 at 14:51
  • @mars YMMV- running an application with carbon code. Some work fine and other refuse to install. I've used UFS or HFSX file systems since OS X 10.1.
    – fd0
    May 26, 2017 at 15:17
-1

I'm not sure about iOS developers' intentions, but the better question is why would you make a filesystem case insensitive. Historically, making filesystems case-insensitive was a mistake.

Here are some of the problems with case-insensitive filesystems.

  • It's poorly defined (think unicode).
  • Every filesystem does it differently.
  • Case-insensitivity should be handled in the UI layer.
  • Case-insensitivity forces layering violations upon other code.
  • Case-insensitivity is contagious.
  • Case-insensitivity can lead to security bugs.
  • Case-insensitivity adds complexity and provides no actual benefit.

In my opinion this is a good enough argument to make the filesystem case-sensitive.

EDIT

Apparently it is discouraged to provide links with more in-depth discussions so I'm removing the links.

1
  • I wasn't arguing that case insensitive fs are good, I was curious about the reasons behind the difference between iOS and OSX, which are strictly related but have a different approach.
    – mars
    Jan 26, 2022 at 21:26

You must log in to answer this question.

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