I am trying to follow this advice from stackoverflow and copy some library files from /usr/local/Cellar/openssl/1.0.1c to /usr/lib/.

I have tried cp, ln -s and even touch, but they all fail. I am using the root credentials:

joyce# whoami

In the right directory:

joyce# pwd

But no write operation is permitted:

joyce# cp /usr/local/Cellar/openssl/1.0.2e_1/lib/libssl.1.0.0.dylib .
cp: ./libssl.1.0.0.dylib: Operation not permitted
joyce# ln -s /usr/local/Cellar/openssl/1.0.2e_1/lib/libssl.1.0.0.dylib .
ln: ./libssl.1.0.0.dylib: Operation not permitted
joyce# touch blah
touch: blah: Operation not permitted

Any idea how can I write to /usr/lib as root?

  • 4
    /usr/lib is protected by SIP, can't you add it to /usr/local/lib and pass appropriate flags to the linker?
    – nohillside
    Commented May 19, 2016 at 8:49
  • 1
    It worked - export DYLD_LIBRARY_PATH=/usr/local/Cellar/openssl/1.0.2e_1/lib. Would you like to make it an answer so I can accept and upvote?
    – Adam Matan
    Commented May 19, 2016 at 9:16
  • Surely easier to use Homebrew to link into /usr/local/lib and make the build use that
    – mmmmmm
    Commented May 19, 2016 at 10:02

1 Answer 1


/usr/lib is protected by SIP. Even if this wouldn't be the case, it's not the best idea to put your own stuff there as any system upgrade can wipe it.

The better place to store such stuff (or link to it) is /usr/local/lib. You may need to pass appropriate flags to the linker then (or you point it directly to the Cellar folder).

You must log in to answer this question.

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