--- src/Makevars.in	2024-10-03 05:55:47.000000000 +0800
+++ src/Makevars.in	2024-10-31 03:50:46.000000000 +0800
@@ -1,27 +1,20 @@
 ## We need C++17 to use TileDB's C++ API
 CXX_STD = CXX17
 
-## We need the TileDB Headers; for macOS aka Darwin need to set minimum version 10.14 for macOS
-PKG_CPPFLAGS = -I. -I../inst/include/ @CXX17_MACOS@ @TILEDB_INCLUDE@ @TILEDB_SILENT_BUILD@ @FILESYSTEM_HEADER_MISSSING@
+## We need the TileDB Headers
+PKG_CPPFLAGS = -I. -I../inst/include/ @TILEDB_INCLUDE@ @TILEDB_SILENT_BUILD@
 
 ## We also need the TileDB library
-PKG_LIBS = @CXX17_MACOS@ @TILEDB_LIBS@ @TILEDB_RPATH@
+PKG_LIBS = @TILEDB_LIBS@ @TILEDB_RPATH@
 
 LIB_CON_DIR = ../inst/lib$(R_ARCH)
 LIB_CON = $(LIB_CON_DIR)/libconnection@DYLIB_EXT@
 
 all: $(OBJECTS) $(LIB_CON) $(SHLIB)
         # On macOS aka Darwin we call install_name_tool
-        # Case one: If we had a downloaded TileDB Core artifact, adjust zlib path and add to @rpath
-        # Case two: If we see the system libraries (on macOS) ensure /usr/local/lib rpath is considered
+        # and ensure the lib is linked to MacPorts-provided tiledb
 	@if [ `uname -s` = 'Darwin' ] && [ -f tiledb.so ]; then \
-	    if [ -f ../inst/tiledb/lib/libtiledb.dylib ] ; then \
-	        install_name_tool -change libz.1.dylib @rpath/libz.1.dylib ../inst/tiledb/lib/libtiledb.dylib; \
-	        install_name_tool -add_rpath @loader_path/../tiledb/lib tiledb.so; \
-	    fi; \
-	    if [ -f /usr/local/lib/libtiledb.dylib ] ; then \
-	        install_name_tool -add_rpath /usr/local/lib tiledb.so; \
-	    fi; \
+	    install_name_tool -change @rpath/libtiledb.dylib @PREFIX@/lib/libtiledb.dylib tiledb.so; \
 	fi
 
 $(LIB_CON): connection/connection.o
