diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml
index b53844b0a81c800fda3082fbe6ac8bd8b037b7ba..0f5e28dd7abb28d7d5c92fd7d3426802608e8bfe 100644
--- a/.gitlab-ci.yml
+++ b/.gitlab-ci.yml
@@ -83,7 +83,7 @@ build_macos_x86_64:
     - macOS
   script:
     - autoreconf -si
-    - './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'
+    - './configure CC=gcc-12 CXX=g++-12 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 17702db1a1cf11f29d7b7b58e9058e01da104238..5d89e7b2e9c7d25113ca695ab76d0ca2176c3bc4 100644
--- a/src/ModelTree.cc
+++ b/src/ModelTree.cc
@@ -1890,8 +1890,8 @@ ModelTree::matlab_arch(const string &mexext)
 string
 ModelTree::findGccOnMacos()
 {
-  const string macos_gcc_version{"11"}; // doc/manual/source/installation-and-configuration.rst
-                                        // should be updated when this is changed
+  const string macos_gcc_version {"12"}; // doc/manual/source/installation-and-configuration.rst
+                                         // should be updated when this is changed
   char dynare_preprocessor_path[PATH_MAX];
   uint32_t size = PATH_MAX;
   string local_gcc_path;