Forums » Saxon/C Help and Discussions »
Running SaxonC 12 transform or query on Mac (Sonoma 14.3) M3
Added by Martin Honnen 11 months ago
I only use Macs occasionally so I don't know my way around permission issues; I am currently trying to run SaxonC 12.4.2 on a Macbook M3, I have download and unzipped and installed the files; I have also managed to compile transform.c and query.c but on running them I get a security/permission problem it seems, first I get an alert window telling the library libsaxon-hec-12.4.2.dylib can't be opened because Apple can't look inside for malware (with a note to contact the developer), on clicking the links to to show further details the shell finally shows errors like
./query -t -s:"current-dateTime()"
dyld[1703]: Library not loaded: @rpath/libsaxon-hec-12.4.2.dylib
Referenced from: <FDDE1E96-B563-32DC-8C9A-6BEF7D862E0C> /Users/martin/libsaxon-HEC-mac-aarch64-v12.4.2/command/query
Reason: tried: '/Users/martin/libsaxon-HEC-mac-aarch64-v12.4.2/libs/darwin/libsaxon-hec-12.4.2.dylib' (code signature in <1D890920-319B-3324-BE4E-10281FFE34CA> '/Users/martin/libsaxon-HEC-mac-aarch64-v12.4.2/libs/darwin/libsaxon-hec-12.4.2.dylib' not valid for use in process: library load disallowed by system policy), '/Users/martin/libsaxon-HEC-mac-aarch64-v12.4.2/libs/darwin/libsaxon-hec-12.4.2.dylib' (code signature in <1D890920-319B-3324-BE4E-10281FFE34CA> '/Users/martin/libsaxon-HEC-mac-aarch64-v12.4.2/libs/darwin/libsaxon-hec-12.4.2.dylib' not valid for use in process: library load disallowed by system policy)
zsh: abort ./query -t -s:"current-dateTime()"
The documentation in https://www.saxonica.com/saxon-c/documentation12/index.html#!starting/installing/installingMac says "If you encounter permission issues after copying, then the privileges of the folders and files may need adjusting." but I have no idea what to do.
Any advice?
Replies (6)
Please register to reply
RE: Running SaxonC 12 transform or query on Mac (Sonoma 14.3) M3 - Added by O'Neil Delpratt 11 months ago
Hi Martin,
The library can be accessed with the DYLD_LBRARY_PATH environment variable. I think that should work. It is also possible to access the library using accessed using @rpath
RE: Running SaxonC 12 transform or query on Mac (Sonoma 14.3) M3 - Added by Martin Honnen 11 months ago
The documentation says LD_LIBRARY_PATH
, for this system I have set it e.g. echo $LD_LIBRARY_PATH
shows /usr/local/lib
and ls -al $LD_LIBRARY_PATH/libsaxon-hec-12.4.2.dylib
shows e.g. -rwxr-xr-x@ 1 root wheel 50873896 27 Jan 16:10 /usr/local/lib/libsaxon-hec-12.4.2.dylib
.
But the error message points to /Users/martin/libsaxon-HEC-mac-aarch64-v12.4.2/libs/darwin/libsaxon-hec-12.4.2.dylib
, not sure how to get the system to use the LD_LIBRARY_PATH lib.
As for your comment, I assume DYLD_LBRARY_PATH
is supposed to say LD_LBRARY_PATH
, or do we need DYLD_LIBRARY_PATH on the Mac?
RE: Running SaxonC 12 transform or query on Mac (Sonoma 14.3) M3 - Added by O'Neil Delpratt 11 months ago
It should be DYLD_LIBRARY_PATH on the Mac
RE: Running SaxonC 12 transform or query on Mac (Sonoma 14.3) M3 - Added by Martin Honnen 11 months ago
Ok, changed the shell profile to set DYLD_LIBRARY_PATH
, output confirms it is set e.g. echo $DYLD_LIBRARY_PATH
gives /usr/local/lib
.
Error message now mentions the /usr/local/lib
dylib i.e.
./query
dyld[2562]: Library not loaded: @rpath/libsaxon-hec-12.4.2.dylib
Referenced from: <FDDE1E96-B563-32DC-8C9A-6BEF7D862E0C> /Users/martin/libsaxon-HEC-mac-aarch64-v12.4.2/command/query
Reason: tried: '/usr/local/lib/libsaxon-hec-12.4.2.dylib' (code signature in <1D890920-319B-3324-BE4E-10281FFE34CA> '/usr/local/lib/libsaxon-hec-12.4.2.dylib' not valid for use in process: library load disallowed by system policy), '/Users/martin/libsaxon-HEC-mac-aarch64-v12.4.2/libs/darwin/libsaxon-hec-12.4.2.dylib' (code signature in <1D890920-319B-3324-BE4E-10281FFE34CA> '/Users/martin/libsaxon-HEC-mac-aarch64-v12.4.2/libs/darwin/libsaxon-hec-12.4.2.dylib' not valid for use in process: library load disallowed by system policy), '/Users/martin/libsaxon-HEC-mac-aarch64-v12.4.2/libs/darwin/libsaxon-hec-12.4.2.dylib' (code signature in <1D890920-319B-3324-BE4E-10281FFE34CA> '/Users/martin/libsaxon-HEC-mac-aarch64-v12.4.2/libs/darwin/libsaxon-hec-12.4.2.dylib' not valid for use in process: library load disallowed by system policy)
zsh: abort ./query
but continues to say "not valid for use in process: library load disallowed by system policy)".
Not sure what to make of it, does that library need to be signed and isn't?
RE: Running SaxonC 12 transform or query on Mac (Sonoma 14.3) M3 - Added by Matt Patterson 11 months ago
Sorry, DYLD_LIBRARY_PATH
is a red herring, unless you have System Integrity Protection turned off (it's on by default). This is almost certainly a Safari-setting-the-quarantine-xattr issue, which means it's a documentation issue.
On macOS 14.2 I can reproduce your error and fix it with quarantine-attribute-removal (I haven't tried on 14.3 yet), so here's how to do that, plus some context:
When you download stuff with Safari it sets some metadata on whatever it was you downloaded to say that it's an internet download, which are initially restricted by the OS (that's the source of the 'this application was downloaded from the internet, do you want to open it?' warning you get with apps downloaded with Safari.
(You can see this metadata with the xattr
command: xattr libsaxon-HEC-mac-aarch64-v12.4.2.zip
)
You can remove the quarantine metadata using the xattr
command, either from the .zip like so:
xattr -d com.apple.quarantine libsaxon-HEC-mac-aarch64-v12.4.2.zip
or from the expanded contents of the archive (if you've already expanded the .zip) with:`
xattr -dr com.apple.quarantine libsaxon-HEC-mac-aarch64-v12.4.2
By default, the build script for in the command
directory says that the executableit builds should look for the .dylib
in the path ../libs/darwin
relative to the exectuable. (That is, the paths as they are in the .zip
.) So, if you expand the zip, remove the com.apple.quarantine
extended attribute, and build it using build64-mac.sh
it ought to work.
I think that there's also a general documentation problem here too: I have a feeling that /usr/local/lib
is no longer (as of a recent OS update) a sensible place to install .dylib
s, and we introduced a change to the way we build the .dylib
to make it more reliable to link against a path you want, rather than a path we choose. I need to investigate the first, and write up the second part more usefully...
I'm just updating to 14.3 myself, and then I should be able to verify that nothing else is on.
RE: Running SaxonC 12 transform or query on Mac (Sonoma 14.3) M3 - Added by Martin Honnen 11 months ago
Thanks, Matt, using xattr -dr
for that com.apple.quarantine
attribute and also doing sudo xattr -d com.apple.quarantine /usr/local/lib/libsaxon-hec-12.4.2.dylib
now that I had the DYLD_LIBRARY_PATH set finally removed all that dialogue permission/security popups and I can run the commands or the sample of C++ of SaxonC fine.
I am pretty sure I downloaded with Google Chrome, I think, so I guess it is just how browsers behave on MacOs (14), not just a Safari thing.
Please register to reply