So, the failure to load the library is somehow connected to the current directory in the Terminal app. I don't know why that would matter, but it looks this is a macOS problem, not a Perl problem.
If I understand right that by changing directory to that which *contains* the actual dylib file, it does work, then that could be because it possibly searches the current directory for the dylib file by default - perhaps not DynaLoader but the OS's dynamic library loader. So, that's to be expected I guess.
Perhaps you can experiment with a directory without spaces, although that's far-fetched and in my linux box a dir with spaces works perfectly. Additionally run strace's OSX equivalent: dtruss as per perlfan's suggestion and/or export any shell debug variables like LD_DEBUG=yes and maybe OSX-specific DYLD_PRINT_LIBRARIES=YES and try to see what's going on. It could say that it did not find the library but it could mean that some other dependencies were not found. Don't forget there are 2 processes at play here: DynaLoader and OS's dynamic library loader.
In reply to Re^5: XSLoader/DynaLoader Can't Locate Library
by bliako
in thread XSLoader/DynaLoader Can't Locate Library
by wbirkett
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |