I found a solution to my problem, thanks to suggestions from you wise monks.

macOS uses the environment variables 'DYLD_LIBRARY_PATH' and 'DYLD_FALLBACK_LIBRARY_PATH' for the location of dynamic libraries or 'dylibs'. From the Terminal app, I was able to load the Rmath dylib successfully by entering

export DYLD_LIBRARY_PATH=/thepath

before running my Perl scripts.

Then I tried setting this variable in my Perl script, but this didn't work. Apparently, the variable must be set in the process that runs Perl. My software runs within TextMate, which uses Ruby to execute programs. So, I added a single line of Ruby code prior to executing Perl,

ENV['DYLD_LIBRARY_PATH'] = "#{ENV["TM_BUNDLE_SUPPORT"]}/lib/perl5"

This did the trick. Now I'm back to productive work. Thanks again to all.


In reply to Re^6: XSLoader/DynaLoader Can't Locate Library by wbirkett
in thread XSLoader/DynaLoader Can't Locate Library by wbirkett

Title:
Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post, it's "PerlMonks-approved HTML":



  • Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
  • Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
  • Read Where should I post X? if you're not absolutely sure you're posting in the right place.
  • Please read these before you post! —
  • Posts may use any of the Perl Monks Approved HTML tags:
    a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
  • You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
            For:     Use:
    & &amp;
    < &lt;
    > &gt;
    [ &#91;
    ] &#93;
  • Link using PerlMonks shortcuts! What shortcuts can I use for linking?
  • See Writeup Formatting Tips and other pages linked from there for more info.