--- src/Makevars	2023-02-01 21:05:25.000000000 +0800
+++ src/Makevars	2024-06-22 10:09:41.000000000 +0800
@@ -49,7 +49,7 @@
         #  - on macOS aka Darwin which needs this
         #  - the library is present (implying non-system library use)
         # then let us call install_name_tool
-	@if [ "$(OS)" != "Windows_NT" ] && [ `uname -s` = 'Darwin' ] && test -e "/usr/bin/install_name_tool"; then /usr/bin/install_name_tool -add_rpath @loader_path/../lib$(R_ARCH) $(USERLIB); fi
+	@if [ "$(OS)" != "Windows_NT" ] && [ `uname -s` = 'Darwin' ] && test -e "/usr/bin/install_name_tool"; then /usr/bin/install_name_tool -id $(R_PACKAGE_DIR)/lib$(R_ARCH)/$(USERLIB) $(USERLIB); fi
 
 $(USERLIBST): $(OBJECTS)
 	$(AR) qc $(USERLIBST) $^
