Skip to content

gh-88130: Document that ctypes on macOS may not search /usr/local/lib - #160985

Closed
helavika wants to merge 1 commit into
python:mainfrom
helavika:gh-88130-ctypes-macos-search
Closed

helavika wants to merge 1 commit into
python:mainfrom
helavika:gh-88130-ctypes-macos-search

Conversation

@helavika

@helavika helavika commented Oct 30, 2026 •

Copy link
Copy Markdown

On current macOS, CDLL("libfoo.dylib") no longer finds libraries in /usr/local/lib or /Library/Frameworks. I checked with the python.org 3.14.10 installer and with a non-codesigned build. dyld's search trace (DYLD_PRINT_SEARCHING=1) shows the only default fallback it tries is /usr/lib. This matches the dyld man page: binaries built with recent SDKs have no default fallback path. So the cause today is the SDK, not only the hardened runtime discussed in the issue.

This adds a short note to the CDLL docs: use the full path, or set DYLD_LIBRARY_PATH / DYLD_FRAMEWORK_PATH before starting Python. Setting them through os.environ at runtime has no effect. I didn't suggest find_library(), since it's soft-deprecated in 3.15.

I used Claude Code to investigate, reproduce and draft this, and verified the behaviour myself on macOS 26.6 (arm64).

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@python-cla-bot

python-cla-bot Bot commented Oct 30, 2026 •

Copy link
Copy Markdown

All commit authors signed the Contributor License Agreement.

CLA signed

@read-the-docs-community

Copy link
Copy Markdown

Documentation build overview

📚 cpython-previews | 🛠️ Build #35531839 | 📁 Comparing 3ef319d against main (4a9b981)

  🔍 Preview build  

1 file changed
± library/ctypes.html

@helavika helavika closed this Oct 30, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

awaiting review docs Documentation in the Doc dir skip news

Projects

Status: Todo

Development

Successfully merging this pull request may close these issues.

1 participant