Sign up ×
Unix & Linux Stack Exchange is a question and answer site for users of Linux, FreeBSD and other Un*x-like operating systems. It's 100% free, no registration required.

I need to make the permissions of a file exactly match the permissions of another file in OS X 10.6.

I don't see 'getfacl' or 'setfacl' as suggested in some other posts for Linux. And, it doesn't look like chown/chmod have a --reference option in Snow Leopard.

What is the equivalent on the Mac?

share|improve this question
Do you want full ACLs or just regular UNIX file permissions? – Useless Mar 4 '12 at 19:51
Full ACLs. I need the files to match exactly. – leanne Mar 6 '12 at 23:03

4 Answers 4

OK, so for a straight ACL copy, I can't see a single command. However, you can put this in a script or function:

ls -le source | sed -En '/^ [[:digit:]]+: / { s/^ [[:digit:]]+: //; p; }' | chmod -E dest


function copyacl()
  ls -le "$1" \
    | sed -En '/^ [[:digit:]]+: / { s/^ [[:digit:]]+: //; p; }' \
    | chmod -E "$2"

$ copyacl sourcefile destfile

I feel like that sed script could be improved, but it seems to do the job.

share|improve this answer

Use ls -le to see any acls a file has associated with it.

Use chmod to change or remove the acls. There are plenty of examples toward the end of the chmod man page to guide you.

Mac OS has a separate set of file access flags, apparently inherited from the BSDs. You can see those with ls -lO (that's dash ell oh) and modify them with chflags.

share|improve this answer
Thanks for the thought, Kyle. However, I was hoping NOT to have to do all that. I'm looking for just a simple permissions copy like the ones noted in my question. – leanne Feb 8 '12 at 21:21

This one works:

chmod `stat -f %A srcFile` dstFile
share|improve this answer
Nope, didn't work. – leanne Sep 29 at 20:13
Hmm works for me. Which version do you have? – Primoz Rome Sep 30 at 10:35

Not sure if you are ask about standard UNIX permissions or for ACL's. Many versions of chmod have a --reference option to take the permissions of another file:

chmod --reference=~/backup/file ~/newfile

But you'll need to check the options for chmod on your Mac:

chmod --help
share|improve this answer
I noted in my post that the --reference option is not there. – leanne Mar 6 '12 at 23:04

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.