diff --git a/src/ModelTree.cc b/src/ModelTree.cc
index 4fc731a9e25679d1fc6732dca01f06a1ac24a583..c9e800d45963aa3e7fcb606c23072b202d525d58 100644
--- a/src/ModelTree.cc
+++ b/src/ModelTree.cc
@@ -2265,7 +2265,7 @@ ModelTree::compileDll(const string &basename, const string &static_or_dynamic, c
       else
         {
           // macOS
-          compiler = "/usr/local/bin/gcc-7";
+          compiler = "/usr/local/bin/gcc-9";
           string archs = (mexext == "maci" ? "i386" : "x86_64");
           flags << " -fno-common -arch " << archs << " -mmacosx-version-min=10.7 -Wl,-twolevel_namespace -undefined error -bundle";
           libs += " -lm -lstdc++";