Beware of the case sensitivity in macOS

Let's see what kind of file system this is:

$ diskutil info / | grep 'File System Personality'
   File System Personality:   APFS

Is it case sensitive?

$ touch /tmp/{foo,Foo,FoO,fOO}

This looks good, the touch command produced different files:

$ ls /tmp/{foo,Foo,FoO,fOO}
-rw-r--r--  1 torstein  wheel     0B Dec 17 13:12 /tmp/FoO
-rw-r--r--  1 torstein  wheel     0B Dec 17 13:12 /tmp/Foo
-rw-r--r--  1 torstein  wheel     0B Dec 17 13:12 /tmp/fOO
-rw-r--r--  1 torstein  wheel     0B Dec 17 13:12 /tmp/foo

Let's check that they can contain different things as well:

$ for el in /tmp/{foo,Foo,FoO,fOO}; do echo $RANDOM > $el; done
$ cat /tmp/{foo,Foo,FoO,fOO}
22247
22247
22247
22247

Woot?! The same integer in all of them?

Let's check the inodes of the files:

$ stat -f %i /tmp/{foo,Foo,FoO,fOO}
24362032
24362032
24362032
24362032

Argh! It's the same inode. So although macOS shows four files, they're all pointing to the same storage unit. Good grief.


~ /home 🏠 ~ talks 💬 ~ bash ~ craftsmanship ~ db ~ dongxi ~ emacs ~ escenic ~ iam ~ identity ~ java ~ js ~ language ~ latex ~ ldap ~ life ~ linux ~ llm ~ mac-os-x ~ mt-foo ~ network ~ norsk ~ python ~ quotes ~ running ~ security ~ travel ~ unix ~ various ~ vcs ~ webdesign ~ windows ~ discoveries ~ cv 🧙 ~

Licensed under CC BY Creative Commons License ~ 📡 RSS feed ~ ✉ torstein.k.johansen @ gmail ~ 🐘 @skybert@hachyderm.io ~ 🎥 youtube.com/@skybert