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

On OS X 10.6.8, I made a small script file in my home directory and tried to make it executable. Surprisingly, I found that chmod had no effect until I ran it as super-user. I own and have write access to my home directory directory and the script, so what prevents chmod from working?

my_mac:~ crowding$ ls -dle ~
drwxr-xr-x+ 214 crowding  staff  7276 Jul 28 16:30 /Users/crowding
 0: group:everyone deny delete
my_mac:~ crowding$ ls -le ~/my_script 
-rw-r--r--  1 crowding  staff  22 Jul 28 16:25 /Users/crowding/my_script
my_mac:~ crowding$ chmod a+x ~/my_script 
my_mac:~ crowding$ ls -le ~/my_script 
-rw-r--r--  1 crowding  staff  22 Jul 28 16:25 /Users/crowding/my_script
my_mac:~ crowding$ sudo chmod a+x ~/my_script 
my_mac:~ crowding$ ls -le ~/my_script 
-rwxr-xr-x  1 crowding  staff  22 Jul 28 16:25 /Users/crowding/my_script
my_mac:~ crowding$
share|improve this question
I can't replicate this. Did you configure ACL? – Gerry Jul 30 '12 at 7:39
The problem seems to be confined to one account on this machine. The ACLs appear normal. and it seems to happen anywhere I try in the file system. It seems to be related to something in my PATH, but not the chmod binary itself. – crowding Jul 31 '12 at 1:47
up vote 0 down vote accepted

It turns out there was another exec "chmod" on the path, obscuring my own chmod.

The thing that made this difficult to see was that I'd used the metacharacter "~" in my PATH variable. Only some things will interpret a tilde in the PATH. The which program does not expand the tilde, so which chmod told me that /bin/chmod was the chmod on the path, but bash does expand the tilde, so it tried to run the other chmod (which did nothing.) Meanwhile, sudo does not expand the tilde so it worked, and gave the impression of a permissions problem.

Resolution: when adding subdirectories of your home directory to your PATH, use $HOME instead of ~.

share|improve this answer
How did you set you PATH variable then? Any ~ in it should get expanded (replaced by /Users/crowding) automatically by the shell when getting assigned to a variable. – patrix Aug 2 '12 at 5:50
~ doesn't get expanded in double quoted strings. – crowding Aug 2 '12 at 5:51
I wouldn't be surprised if other things break as well if you have ~ in $PATH. That's why I always recommend to avoid using quotes when assigning something to $PATH. – patrix Aug 2 '12 at 5:54

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.