Macos – Is the cp command case sensitive on OS X Mavericks (10.9)

bashmacos

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.

Best Answer

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.

Related Question