Pavel Durov
p3ld3v blog


p3ld3v blog

macOS FS vs Linux FS - case sensitivity

macOS FS vs Linux FS - case sensitivity

Pavel Durov's photo
Pavel Durov
·Oct 31, 2022·

3 min read

Table of contents

  • macOS FS vs Linux FS - case sensitivity
  • Abstract
  • Intro
  • Experiment - maxOS FS case sensitivity
  • Conclusion
  • References

macOS FS vs Linux FS - case sensitivity


In this article, I will overview the case-sensitivity difference between macOS default filesystem (FS) and Linux filesystem with some practical examples and gotchas.


Unix and Linux might sound the same to some of us, but they are different beasts. macOS aka OS X or Max OS X is a Unix-based operating system, while Linux is Unix-like OS. There are many articles explaining the difference [1]. No need to repeat.

Experiment - maxOS FS case sensitivity

Let's do an experiment 🤓. Assuming that you're running on macOS, create a file called with content:


echo "hello"

Try running it as:

$ bash ./

Now rename it to (with capital E) and run again:

$ bash ./

Works anyway! File names are case insensitive, meaning that you can run it even as:

$ bash ./

I don't know how about you, but when I found it for the first time I was really surprised. When working with a mac, on the surface, it looks and feels very Linuxy, the terminal, the shell, the commands, the paths... It's all been a lie 😭.

Let's see how case-sensitivity would work on Linux using Docker

Define a simple dockerfile:

FROM alpine:3.14
COPY ./ /poc/
ENTRYPOINT ["/bin/sh", "/poc/" ]

Here we're copying the file and running it as the ENTRYPOINT command. Notice that we run the lowercased file but we copied in uppercased file! Well, running it won't work since Linux filesystem is case-sensitive:

$ docker build -t macOS-FS . && docker run -t macOS-FS
/bin/sh: can't open '/poc/': No such file or directory

If we change the entrypoint to /poc/ it should work. Try it yourself!

FS case-sensitivity and Git

Another thing to note is that since FS is case-insensitive, these changes will not be tracked in Git 😶. I know! Quite shocking to stop thinking of Git as the source of the absolute truth of text-based file changes! The same experiment can be done by renaming one of the tracked files and seeing the Git-detected changes 🤯. It got me personally multiple times over the past years when programs worked locally but failed to launch in Linux-based containers or in my lovely CI/CD pipelines.

Using macOS case-sensitive file system

It's possible to have a case-sensitive filesystem on macOS. For that, we need to set the disc to use APFS (Case-sensitive) format: "APFS (Case-sensitive): Uses the APFS format, is case-sensitive to file and folder names. For example, folders named “Homework” and “HOMEWORK” are two different folders." [2].

However, it might be risky. Most macOS applications don’t recognize a case-sensitive file system. And probably won’t work as expected. So wouldn't recommend it. On the other hand, it might make sense to set a separate partition on your drive to be case-sensitive, especially if you work with Linux-based systems quite often. But not the whole drive.


macOS and Linux might look and feel the same, but in reality, they are quite different. Filesystem case sensitivity is only one example of such diffrence. I hope that this short overview of case-sensitivity differences was useful. And you won't be caught off-guard next time your application won't run when Git didn't pick up on file rename changes on macOS.




Share this