diff --git a/tasks/bin/cross-ruby.rake b/tasks/bin/cross-ruby.rake
index d37ab97b..512afbf4 100644
--- a/tasks/bin/cross-ruby.rake
+++ b/tasks/bin/cross-ruby.rake
@@ -129,6 +129,11 @@
 
     # make
     file "#{build_dir}/ruby.exe" => ["#{build_dir}/Makefile"] do |t|
+      if ruby_cc_version.start_with?("ruby-3.1") && mingw_target =~ /darwin/
+        # for later 3.1.x releases, we need to explicitly build miniruby
+        # see https://bugs.ruby-lang.org/issues/19239
+        sh "#{MAKE} miniruby", chdir: File.dirname(t.prerequisites.first)
+      end
       sh MAKE, chdir: File.dirname(t.prerequisites.first)
     end
 
