diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml
index 7fd39e40b2ada5dc5035ed323155c88af9dc9d07..fccd96eb91c3a1a12e90ecd3c5ea04219f30f7e0 100644
--- a/.gitlab-ci.yml
+++ b/.gitlab-ci.yml
@@ -83,7 +83,7 @@ build_macos_x86_64:
     - macOS
   script:
     - autoreconf -si
-    - './configure CC=gcc-10 CXX=g++-10 LDFLAGS="-static-libgcc -s" LEX=/usr/local/opt/flex/bin/flex YACC=/usr/local/opt/bison/bin/bison'
+    - './configure CC=gcc-11 CXX=g++-11 LDFLAGS="-static-libgcc -s" LEX=/usr/local/opt/flex/bin/flex YACC=/usr/local/opt/bison/bin/bison'
     - make -j$(nproc)
     - mkdir -p $CI_COMMIT_SHA/macos-x86_64
     - tar -caf $CI_COMMIT_SHA/macos-x86_64/dynare-preprocessor.tar.gz -C src dynare-preprocessor
diff --git a/src/ModelTree.cc b/src/ModelTree.cc
index bcfc7754c6405fcc67ab21673d4c5c507c86a60b..a20f3d7f36dd647d3916b2a458b605695a95894b 100644
--- a/src/ModelTree.cc
+++ b/src/ModelTree.cc
@@ -1957,16 +1957,16 @@ ModelTree::compileMEX(const string &basename, const string &funcname, const stri
           if (_NSGetExecutablePath(dynare_m_path, &size) == 0)
             {
               string str = dynare_m_path;
-              gcc_relative_path = str.substr(0, str.find_last_of("/")) + "/../../.brew/bin/gcc-10";
+              gcc_relative_path = str.substr(0, str.find_last_of("/")) + "/../../.brew/bin/gcc-11";
             }
 
           if (filesystem::exists(gcc_relative_path))
             compiler = gcc_relative_path;
-          else if (filesystem::exists("/usr/local/bin/gcc-10"))
-            compiler = "/usr/local/bin/gcc-10";
+          else if (filesystem::exists("/usr/local/bin/gcc-11"))
+            compiler = "/usr/local/bin/gcc-11";
           else
             {
-              cerr << "ERROR: You must install gcc-10 on your system before using the `use_dll` option of Dynare. "
+              cerr << "ERROR: You must install gcc-11 on your system before using the `use_dll` option of Dynare. "
                    << "You can do this via the Dynare installation package." << endl;
               exit(EXIT_FAILURE);
             }