In shell scripts used for unit testing with dynamic libraries in a directory other than the typical @rpath, I have previously been able to set DYLD_FALLBACK_LIBRARY_PATH to set the directory containing the libraries. Under 10.11.1, bash seems to ignore attempts to set this environment variable:
$ sh -x testscript.sh
+ DYLD_FALLBACK_LIBRARY_PATH=/Users/something/testinglibs
+ export DYLD_FALLBACK_LIBRARY_PATH
+ exec printenv
and DYLD_FALLBACK_LIBRARY_PATH is not present in printenv's output.
Is this a security-related hack in 10.11's shell? I haven't been able to find this change documented in man pages or online.
Best Answer
This is System Integrity Protection introduced in El Capitan
Documentation is in this from Apple
Basically any Apple supplied OS X executables are protected. and (from an earlier document)
In this case sh is protected