5

Is this a bug in OS X or I have something misconfigured?

$ touch aaa
$ ls -l
total 0
-rw-r--r--  1 jchen  1366545133  0 Feb 16 16:08 aaa
$ cp aaa AAA
cp: AAA and aaa are identical (not copied).
$ ln -s aaa AAA
ln: AAA: File exists
$ env | grep SHELL
SHELL=/bin/bash

It seems cp and ln in OS X are not case sensitive. I never noticed this until I tried to create a symbolic link as an upper case folder to a lower case name.

On Linux I've never seen such a problem.

2 Answers2

6

The problem is that the HFS+ file system OS X runs on is case insensitive by default.

Under Disk Utility you can erase and re-partition volumes to use a case sensitive version of HFS+ though – it's selectable as a format:

Changing the case sensitivity of the boot volume is more difficult and usually involves formatting the drive and restoring from a backup.

slhck
  • 235,242
3

By default, the OS X file system is not case-sensitive.

You can choose to use a case-sensitive file system when installing Mac OS. This will however cause problems with some software (e.g., Adobe Creative Suite). As mentioned in the comment below by Joe Block, you'll be better off creating a case-sensitive file system on a non-boot volume or disk image.

You can create a disk image with case-sensitive file system using Disk Utility, following the guide provided by Apple. You can also create a disk image from the command line (e.g., using this answer on Ask Different), but be sure to specify the correct file system.

To create a 2GB disk image with case-sensitive file system you could run the following command:

hdiutil create -size 2g -fs 'Case-sensitive Journaled HFS+' \
  -type SPARSEBUNDLE ~/path/to/your/image
inz
  • 131