@@ -170,7 +170,7 @@ for binary in "${binaries_to_check[@]}"; do
170170 otool -L " $binary_path " | awk ' {print $1}' | grep -E ' /opt/homebrew|/usr/local|@executable_path|' " $INSTALL_DIR " | while read dep; do
171171 # Copy the dependency to the lib folder if it’s not already there
172172 cp -Lf " $dep " " $INSTALL_DIR /lib/" 2> /dev/null || true
173- install_name_tool -change " $dep " " @executable_path /../lib/$( basename " $dep " ) " " $binary_path "
173+ install_name_tool -change " $dep " " @loader_path /../lib/$( basename " $dep " ) " " $binary_path "
174174
175175 # Create version-agnostic symlinks
176176 base_name=$( basename " $dep " )
@@ -192,20 +192,20 @@ for icu_lib in "${icu_libs[@]}"; do
192192 cp -Lf " $( brew --prefix icu4c) /lib/$icu_lib " " $INSTALL_DIR /lib/"
193193
194194 # Adjust internal paths to use @loader_path
195- install_name_tool -id " @executable_path /../lib/$icu_lib " " $INSTALL_DIR /lib/$icu_lib "
195+ install_name_tool -id " @loader_path /../lib/$icu_lib " " $INSTALL_DIR /lib/$icu_lib "
196196 otool -L " $INSTALL_DIR /lib/$icu_lib " | awk ' {print $1}' | grep " @loader_path" | while read dep; do
197- install_name_tool -change " $dep " " @loader_path/$( basename " $dep " ) " " $INSTALL_DIR /lib/$icu_lib "
197+ install_name_tool -change " $dep " " @loader_path/../lib/ $( basename " $dep " ) " " $INSTALL_DIR /lib/$icu_lib "
198198 done
199199 # codesign --force --sign - "$INSTALL_DIR/lib/$icu_lib"
200200done
201201
202202# Update library paths within each .dylib in the lib directory
203203for dylib in $INSTALL_DIR /lib/* .dylib; do
204- install_name_tool -id " @executable_path /../lib/$( basename " $dylib " ) " " $dylib "
204+ install_name_tool -id " @loader_path /../lib/$( basename " $dylib " ) " " $dylib "
205205 otool -L " $dylib " | awk ' {print $1}' | grep -E ' /opt/homebrew|/usr/local|@executable_path|' " $INSTALL_DIR " | while read dep; do
206206 # Ensure the library is copied to the lib folder if it’s not already there
207207 cp -Lf " $dep " " $INSTALL_DIR /lib/" 2> /dev/null || true
208- install_name_tool -change " $dep " " @executable_path /../lib/$( basename " $dep " ) " " $dylib "
208+ install_name_tool -change " $dep " " @loader_path /../lib/$( basename " $dep " ) " " $dylib "
209209
210210 # Create version-agnostic symlinks
211211 base_name=$( basename " $dep " )
0 commit comments