diff --git a/com.oracle.truffle.r.native/fficall/Makefile b/com.oracle.truffle.r.native/fficall/Makefile
index 414f1c4d75c7c351189b09cd8d119c6e111f88c5..58b03709a572f46b7bf6c55934ba05f191ceb3dd 100644
--- a/com.oracle.truffle.r.native/fficall/Makefile
+++ b/com.oracle.truffle.r.native/fficall/Makefile
@@ -56,7 +56,7 @@ ifeq ($(OS_NAME),Darwin)
 # check if we captured libpcre/libz, rpath those in libR
 	mx rupdatelib $(FASTR_LIB_DIR)
 else
-	$(DYLIB_LD) $(DYLIB_LDFLAGS) -Wl,-rpath,$(FASTR_LIB_DIR) -o $(R_LIB) $(wildcard lib/*.o) -L$(FASTR_LIB_DIR) -lRblas -lRlapack  -lpcre -lz
+	$(DYLIB_LD) $(DYLIB_LDFLAGS) -Wl,-rpath,'$$ORIGIN' -o $(R_LIB) $(wildcard lib/*.o) -L$(FASTR_LIB_DIR) -lRblas -lRlapack  -lpcre -lz
 endif
 
 objs:
diff --git a/com.oracle.truffle.r.native/library/lib.mk b/com.oracle.truffle.r.native/library/lib.mk
index 81eb0a368ef0c06cb63274aabff46db2175104f4..727f096cb6a84cd50cc5e6250ce2aadc3e471375 100644
--- a/com.oracle.truffle.r.native/library/lib.mk
+++ b/com.oracle.truffle.r.native/library/lib.mk
@@ -109,7 +109,7 @@ $(LIB_PKG): $(C_OBJECTS) $(F_OBJECTS) $(GNUR_C_OBJECTS) $(GNUR_F_OBJECTS) $(PKGD
 	mkdir -p $(FASTR_LIBRARY_DIR)/$(PKG)/libs
 	cp $(LIB_PKG) $(FASTR_LIBRARY_DIR)/$(PKG)/libs
 ifeq ($(OS_NAME),Darwin)
-	install_name_tool -id @loader_path/../library/$(PKG)/libs/$(PKG).so $(FASTR_LIBRARY_DIR)/$(PKG)/libs/$(PKG).so
+	install_name_tool -id @rpath/../library/$(PKG)/libs/$(PKG).so $(FASTR_LIBRARY_DIR)/$(PKG)/libs/$(PKG).so
 endif
 
 $(OBJ)/%.o: $(SRC)/%.c $(H_SOURCES)
diff --git a/mx.fastr/mx_copylib.py b/mx.fastr/mx_copylib.py
index 9a64d80939c0531a9b2e96bd856f9b573079a0ea..68cd691309bb6c37964a36a5bf9175c3e2a0acaf 100644
--- a/mx.fastr/mx_copylib.py
+++ b/mx.fastr/mx_copylib.py
@@ -101,14 +101,15 @@ def copylib(args):
         plain_libpath = lib_prefix + ext
         for part in parts:
             path = part.strip('"').lstrip('-L')
-            for f in os.listdir(path):
-                if f.startswith(lib_prefix):
-                    if os.path.exists(os.path.join(path, plain_libpath)):
-                        f = plain_libpath
-                    target_dir = args[1]
-                    if not os.path.exists(os.path.join(target_dir, f)):
-                        _copylib(args[0], os.path.join(path, f), args[1])
-                    return 0
+            if os.path.exists(path):
+                for f in os.listdir(path):
+                    if f.startswith(lib_prefix):
+                        if os.path.exists(os.path.join(path, plain_libpath)):
+                            f = plain_libpath
+                        target_dir = args[1]
+                        if not os.path.exists(os.path.join(target_dir, f)):
+                            _copylib(args[0], os.path.join(path, f), args[1])
+                        return 0
 
     mx.log(args[0] + ' not found in PKG_LDFLAGS_OVERRIDE, assuming system location')
 
@@ -132,6 +133,8 @@ def updatelib(args):
     cap_libs = []
     libs = []
     for lib in os.listdir(libdir):
+        if not '.dylib' in lib:
+            continue
         if not os.path.islink(os.path.join(libdir, lib)):
             libs.append(lib)
         if ignorelib(lib) or os.path.islink(os.path.join(libdir, lib)):