how to change a dylib path declared from inside an executable or another dylib
making a portable app with all its dependencies
using the otool command we can see the dependencies any given exe or lib may have.
here, we can see the path to the SDL dependency is /usr/local/lib/
so we copy over the libs from /usr/local/lib/libSDL* into the game dir
here we change the path to the dependencies, as defined in the game exe
here we change the path to the other sdl components defined in each lib
for ex: libsdl_gfx, libsdl_mixer and libsdl_image they all use the base libsdl library
so we need to tell them all where we've put the base libsdl library, that is in game dir.
all change being done, we now verify using the otool command that
the path is correctly changed everywhere
so now the sdl libs are all in the game dir, and the game is portable and self contained with all its deps.
source:
grrussel openxcom osxstackoverflow 1stackoverflow 2stackoverflow 3