[New-bugs-announce] [issue43773] macOS official installer builds not respecting DYLD_LIBRARY_PATH environment variable.

Carlton Gibson report at bugs.python.org
Thu Apr 8 09:31:56 EDT 2021

New submission from Carlton Gibson <carlton.gibson at noumenal.es>:


On MacOS 11.3 "Big Sur", with the latest 3.9.4 installed with the official installer downloaded from python.org, the DYLD_LIBRARY_PATH environment variable is not being respected. 

This looks very similar to Issue40198

To begin everything looks correct as per 40198:

    ~ $ python3 --version
    Python 3.9.4
    ~ $ which python3
    ~ $ codesign --display --entitlements=:- /Library/Frameworks/Python.framework/Versions/3.9/bin/python3
    <?xml version="1.0" encoding="UTF-8"?>
    <!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
    <plist version="1.0">

The active python is that from the official installer, and it looks to have the correct entitlements, as per the resolution to 40198. 

However, it's not working in practice. 

I create a script test: 

    ~ $ cat ~/bin/sqlite_config.py 
    import os
    import sqlite3

    print("DYLD_LIBRARY_PATH:" )

    print("SQLite Version:")

Together with a compiled SQLite version: 

    ~ $ ls /Users/carlton/lib/sqlite/3.35.4

Trying to use this, the dylib is not picked up: 

    ~ $ DYLD_LIBRARY_PATH="/Users/carlton/lib/sqlite/3.35.4" python3 ~/bin/sqlite_config.py 
    SQLite Version:

Contrast the same when run with a pyenv installed python: 

    ~ $ pyenv which python3.8
    ~ $ DYLD_LIBRARY_PATH="/Users/carlton/lib/sqlite/3.35.4" /Users/carlton/.pyenv/versions/3.8.3/bin/python3.8 ~/bin/sqlite_config.py 
    SQLite Version:

The expected result, in both cases, is that the last lines should read: 

    SQLite Version:

I don't know if this is the result of a tightening in macOS' SIP in Big Sur (or something else entirely...) — I thought to test it by installing the official build in a different location (so not in the SIP protected `/Library/` space but somewhere in `~` but the installer doesn't look like it allows that (no doubt for good reasons). 

Next step for me with be building from source to see if I can dig deeper, but I thought I'd report it, as it does look like a change in behaviour from the *success* reported in 40198. 

Thanks very much!

components: macOS
messages: 390529
nosy: carltongibson, ned.deily, ronaldoussoren
priority: normal
severity: normal
status: open
title: macOS official installer builds not respecting DYLD_LIBRARY_PATH environment variable.
type: behavior
versions: Python 3.9

Python tracker <report at bugs.python.org>

More information about the New-bugs-announce mailing list