diff --git a/Doc/library/ctypes.rst b/Doc/library/ctypes.rst index 6f3524e0253bca..9ce441b09039c3 100644 --- a/Doc/library/ctypes.rst +++ b/Doc/library/ctypes.rst @@ -1584,6 +1584,14 @@ way is to instantiate :py:class:`CDLL` or one of its subclasses: they are not added automatically. See :ref:`ctypes-finding-shared-libraries` for more information. + On macOS, a *name* that is not an absolute path may only be searched + for in system locations such as :file:`/usr/lib`. Libraries and + frameworks in folders like :file:`/usr/local/lib`, :file:`~/lib` or + :file:`~/Library/Frameworks` are then not found, so pass the full path. + Setting :envvar:`!DYLD_LIBRARY_PATH` or :envvar:`!DYLD_FRAMEWORK_PATH` + before starting Python adds search locations, but macOS ignores these + variables for some executables. + On non-Windows systems, *name* can be ``None``. In this case, :c:func:`!dlopen` is called with ``NULL``, which opens the main program as a "library". diff --git a/Misc/NEWS.d/next/Documentation/2026-11-08-16-26-47.gh-issue-88130.JVOGb1.rst b/Misc/NEWS.d/next/Documentation/2026-11-08-16-26-47.gh-issue-88130.JVOGb1.rst new file mode 100644 index 00000000000000..f5b923d05a73d6 --- /dev/null +++ b/Misc/NEWS.d/next/Documentation/2026-11-08-16-26-47.gh-issue-88130.JVOGb1.rst @@ -0,0 +1,2 @@ +Document that :class:`ctypes.CDLL` on macOS may not find libraries in +:file:`/usr/local/lib` or user folders unless given a full path.