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 Answers 2

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.

5
  • 4
    It's useful to know that some software cannot deal with case-sensitive file systems, since it's a rather uncommon option (including some of Adobe's products IIRC).
    – Daniel Beck
    Feb 16, 2014 at 21:31
  • Yeah, I've heard about Photoshop not liking it. See also: Mac - Convert from Case-Sensitive to Case-Insensitive File System
    – slhck
    Feb 16, 2014 at 21:35
  • 1
    @slhck Thanks! Then how come I can mv aaa AAA? Feb 17, 2014 at 0:32
  • 1
    @JingshaoChen On my system (Mavericks.0), mv -i foo FOO gives overwrite FOO? (y/n [n]) . (mv without -i will quietly clobber the destination file.) Feb 17, 2014 at 2:23
  • 1
    You can do that because OS X will happily (and meaninglessly) change the directory entry to be AAA. You'll still be able to access the file as aaa, though. This is really frustrating for webdevs who are developing on their case-insensitive OS X where either path works but deploying to case-sensitive Linux/Solaris where suddenly a bunch of links go dead.
    – Joe Block
    Feb 17, 2014 at 2:25
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
2
  • 1
    You can choose it during installation, but it is a horrible idea because a lot of software (I'm talking about you, Adobe) never gets tested on anything but a default case-insensitive filesystem. If you need a case-sensitive filesystem, do it on a non-boot partition or in a disk image. That's what I suggested to my web-dev users so that they wouldn't have issues where "the site works on my laptop but not on the (linux) production server."
    – Joe Block
    Feb 17, 2014 at 2:18
  • 1
    Yes, if you're going to use anything by Adobe, there are going to be problems. Here's to hoping that they will someday care enough to produce decent software packages. In the meantime, I'll edit my answer to mention this.
    – inz
    Feb 17, 2014 at 9:17

You must log in to answer this question.

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