Ask Different is a question and answer site for power users of Apple hardware and software. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

Are bash commands on OSX case insensitive? I type "which TR" and it shows /usr/bin/TR, though there is no such binary there. Same thing for other binaries, when capitalized. Or is maybe doing this translation? How do I turn this off?

share|improve this question
Out of curiosity, why would you want to turn this off? – Sören Kuklau Aug 17 '11 at 16:04
This is a spectacular question. Bash has a nocaseglob option to control whether cases match in ranges, but this little bit of trickery is deeper than the normal locale and completion-ignore-case / nocaseglob – bmike Aug 17 '11 at 16:11
The reason I wanted to turn it off is silly, really. I'm used to case sensitivity when working at the shell. I am just worried this feature will trip me up. Example, I write a bash script, mistype 'lS'; the script will run fine on OSX. I move it to my cenTOS box, and it breaks. Granted, this would be easy to detect and fix, but could avoid the scenario entirely if I could keep the scripts working the same way between the two systems. I discovered this by accident, and it hasn't been a nuisance thus far, so I probably will not go through the exercise changing filesystems just for this. – verboze Aug 19 '11 at 1:30
The reason you would want to turn this off is that case insensitivity causes problems for some apps, like SVN. Case insensitive globbing could be useful, but SVN gets very very confused if you create a file called "Foo", then somehow the repository creates a reference to "foo". – user41214 Feb 5 '13 at 19:01
Another reason to disable: I have had a script ~/bin/CC in my path since circa 1980. cc plus some pleasant defaults. It has worked from UNIX v6 through v7, Eunice, BSD 4.1, 4.2, 4.3, SVr4, Xenix, Gould UTX, Linux, cygwin... and it failed for the first time on MacOS, infinite recursion. – Krazy Glew Oct 9 '15 at 2:24
up vote 69 down vote accepted

This is actually a feature of the filesystem of your disk, not bash or

HFS+ (the Mac filesystem) is usually configured to be case insensitive but case preserving. This means that the file system will consider foo and FoO to be the same, but when you create a new file it will remember which letters where capitalized and which were not.

When you format a disk with HFS+ you can chose whether the file system should case sensitive or not. If you chose to format with UFS (Unix FileSystem) it is always case sensitive, AFAIK.

To check whether a disk is case sensitive, run:

 diskutil info <device>

For example:

 diskutil info disk0s2

Look for the Name: line. If it reads something like Mac OS Extended (Case-sensitive, Journaled) it means that it is case-sensitive. If it just reads Mac OS Extended (without the Case-sensitive) then it is only case preserving but not case sensitive.

share|improve this answer
HFS+ really is a bit of an oddity, having the ability to both recognise and ignore case at the same time. Your case preserving note was missing from my answer, and is important for a Unix based OS which would normally be expected to be case sensitive where Foo and FOO are 2 different files. I suspect the behaviour came about between Mac OS 9 HFS and Mac OS X HFS+ and the requirement to be understood by both classic and new apps etc. – stuffe Aug 17 '11 at 16:49
Outside of Unix, the case preserving nature isn't so unusual. For example, NTFS is the similar: not case sensitive by default, but you can format it so it is. I also think that the case insensitive is default came via Mac OS 9, but the fact that a lot of Mac and Windows developers are lazy in this respect and don't care about correct casing makes it almost impossible to switch to case sensitive as default, it breaks lots of apps. Coming from Unix, I found it very strange at first as well. – DarkDust Aug 17 '11 at 16:57
I have to admit I never used Classic Mac OS, so was guessing. Either way, this is the answer, and DarkDust put it better than me so this one should be accepted I think. – stuffe Aug 17 '11 at 17:11
Every version of Mac OS has been case-insensitive-but-preserving, for usability reasons. While UNIX favours precision (byte-by-byte comparisons of filenames), it can be a usability nightmare for end users who accidentally save 'Resume' and 'REsume' and then get confused when they open the wrong version and all their changes are gone. – Dan Udey Aug 17 '11 at 17:30
On the other hand, it can also be a "usability nightmare" when typing "HEAD" at the command-line results in the program /usr/bin/head (show first lines of a file) being executed instead of /usr/local/bin/HEAD (from LWP: make an HTTP 'HEAD' request). – TML Apr 23 '13 at 17:12

Take a look at your filesystem, as there are both case sensitive and case insensitive variations on HFS. The default is case insensitive, in which case it's not so much a case of BASH, but the underlying filesystem. You can test this by formatting a spare USB stick with the case sensitive option, and copying files over ato repeat your test, etc.

share|improve this answer

I managed to fix this with one line by following this:

Just be sure not to put the '>' at the beginning!

share|improve this answer
Welcome to the site. We appreciate the link and if you want to, click edit and summarize the steps as that helps people know what the answer might be - especially if the link goes down or changes. – bmike Dec 31 '13 at 20:17

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.