Platform MacOs Sequoia 15.5.
My objective is to enable an application to find a dynamic library.
My plan is to use launchctl to set the environment variable DYLD_LIBRARY_PATH and then lanch the application.
It appears that launchctl will not do this, there seems to be something special about this specific environment variable.
launchctl setenv DYLD_LIBRARY_PATH /Library/ODBC/ODBCDataSources
launchctl getenv DYLD_LIBRARY_PATH
... result nothing, not output
Try a different environment variable:
launchctl setenv SDYLD_LIBRARY_PATH /Library/ODBC/ODBCDataSources
launchctl getenv SDYLD_LIBRARY_PATH
/Library/ODBC/ODBCDataSources. <== result as expected
The reason I'm doing this is I want Excel to connect to my postgres database. I have ODBC drivers installed and the driver requires a dynamic library. The sandbox system prevents the loading. I needed to place the psqlodbca.so in a /Library/ODBC/ODBCDataSources, but I can't find how to control the search path for libpq.5.dylib
Full error message:
dlopen(/Library/ODBC/ODBCDataSources/psqlodbca.so, 0x0006): Library not loaded: /opt/homebrew/opt/libpq/lib/libpq.5.dylib Referenced from: <123026D6-8774-396E-AB04-63B223BD966F> /Library/ODBC/ODBCDataSources/psqlodbca.so Reason: tried: '/opt/homebrew/opt/libpq/lib/libpq.5.dylib' (file system sandbox blocked open()), '/System/Volumes/Preboot/Cryptexes/OS/opt/homebrew/opt/libpq/lib/libpq.5.dylib' (no such file), '/opt/homebrew/opt/libpq/lib/libpq.5.dylib' (file system sandbox blocked open())
I'd welcome any suggestions
DYLD_LIBRARY_PATH=/Library/ODBC/ODBCDataSources path-to-excelto see if it works?