diff --git a/src/ModelTree.cc b/src/ModelTree.cc
index 66ba7f9c31ff74dfd03ca5b421d464c04cf3c2ee..8e6ad0bae383fc7bed4bf061736d4955ab233aeb 100644
--- a/src/ModelTree.cc
+++ b/src/ModelTree.cc
@@ -1784,13 +1784,15 @@ ModelTree::matlab_arch(const string &mexext)
     return "win32";
   else if (mexext == "mexw64")
     return "win64";
-  else if (mexext == "mexmaci")
+  else if (mexext == "mexmaci" || mexext == "mexmaca")
     {
       cerr << "32-bit MATLAB not supported on macOS" << endl;
       exit(EXIT_FAILURE);
     }
   else if (mexext == "mexmaci64")
     return "maci64";
+  else if (mexext == "mexmaca64")
+    return "maca64";
   else
     {
       cerr << "ERROR: 'mexext' option to preprocessor incorrectly set, needed with 'use_dll'" << endl;
@@ -1818,6 +1820,9 @@ ModelTree::findGccOnMacos()
   else if (string global_gcc_path = "/usr/local/bin/gcc-" + macos_gcc_version;
            filesystem::exists(global_gcc_path))
     return global_gcc_path;
+  else if (string global_gcc_path = "/opt/homebrew/bin/gcc-" + macos_gcc_version;
+           filesystem::exists(global_gcc_path))
+    return global_gcc_path;
   else
     {
       cerr << "ERROR: You must install gcc-" << macos_gcc_version
@@ -1900,7 +1905,7 @@ ModelTree::compileMEX(const string &basename, const string &funcname, const stri
             }
         }
 #ifdef __APPLE__
-      else if (mexext == "mexmaci64")
+      else if (mexext == "mexmaca64" || mexext == "mexmaci64")
         {
           compiler = findGccOnMacos();
           flags << " -fno-common -Wl,-twolevel_namespace -undefined error -bundle";