After reading the link that Justin provided, I was successfully able to use the @executable_path token to change my dylib install_name to point to the same dir where my executable is located.
@executable_path Absolute paths are annoying. Sometimes you want to embed a framework into an application instead of having to install
the framework into /Library or a similar location.
The Mac's solution to this is @executable_path. This is a magic token
that, when placed at the beginning of a library's install name, gets
expanded to the path of the executable that's loading it, minus the
last component. For example, let's say that Bar.app links against
Foo.framework. If Bar.app is installed in /Applications,
@executable_path will expand to /Applications/Bar.app/Contents/MacOS.
If you intend to embed the framework in Contents/Frameworks, then you
can just set Foo.framework's install name to
@executable_path/../Frameworks/Foo.framework/Versions/A/Foo. The
dynamic linker will expand that to
/Applications/Bar.app/Contents/MacOS/../Frameworks/Foo.framework/Versions/A/Foo
and will find the framework there.
http://www.mikeash.com/pyblog/friday-qa-2009-11-06-linking-and-install-names.html
I will demonstrate with an example.
Let's say I have the following executable /opt/local/bin/convert and its dylibs are in /opt/local/lib.
I want to copy it to another dir and have it load its dylibs from the same directory as where I copied the executable.
> mkdir ~/tmp/bin
> cp /opt/local/bin/convert ~/tmp/bin
Get a list of the executables dylibs
> otool -L ~/tmp/bin/convert
~/tmp/bin/convert:
/opt/local/lib/libtiff.3.dylib (compatibility ver
answered 2012-07-20T18:46:06.910