pylink icon indicating copy to clipboard operation
pylink copied to clipboard

Instructions on dealing with external dependencies on Mac

Open ccattuto opened this issue 3 years ago • 2 comments

On recent versions of OSX (tested on Big Sur), it is by default impossible to set some environment variables, including DYLD_LIBRARY_PATH. Hence the suggested Option B, reported below, does not work.

# Option B: Add SEGGER's J-Link directory to your dynamic libraries path.
$ export DYLD_LIBRARY_PATH=/Applications/SEGGER/JLink:$DYLD_LIBRARY_PATH

ccattuto avatar Nov 27 '21 23:11 ccattuto

Sorry about the long response here. I am on BIG Sur and I am able to export the path. What are you seeing get output when you do?

hkpeprah avatar Dec 12 '21 01:12 hkpeprah

DYLD_LIBRARY_PATH can be set, but System Integrity Protection on OSX will "sanitize" it. Example:

% export DYLD_LIBRARY_PATH=/Applications/SEGGER/JLink:$DYLD_LIBRARY_PATH
% echo $DYLD_LIBRARY_PATH
/Applications/SEGGER/JLink:

% cat test.sh
#!/bin/sh
echo $DYLD_LIBRARY_PATH

% ./test.sh

%

See also this: https://en.wikipedia.org/wiki/System_Integrity_Protection

System Integrity Protection will also sanitize certain environmental variables when calling system programs when SIP is in effect. For example, SIP will sanitize LD_LIBRARY_PATH and DYLD_LIBRARY_PATH before calling a system program like /bin/bash to avoid code injections into the Bash process. [..]

And, e.g., the comments here: https://fullstaq.com/an-alternative-to-macos-dyld-library-path/

ccattuto avatar Dec 12 '21 08:12 ccattuto