How To Cross Compile C++ Programs From Mac OS Sonoma To Windows x86_64
This took me way too fucking long to figure out…
I honestly didn’t think cross compiling C++ from Mac OS to Windows was going to be this difficult to set up…
Just so we’re on the same page, I’m talking about Apple silicon Macs, you know, M1, M1 Max, M2, M2 Max, etc.
I only tested this on my own M1 Max running the latest version of Sonoma at the time of writing which is Sonoma 14.1.1 (23B81).
If you’re on a stone age version of Macbook that uses Intel x86_64 architecture chips…consider upgrading. But as a heads up — this method may not work for those older types.
As for Windows, I’m using Windows 11 Pro (build version 22631).
Now onto the method…
Method
Install Homebrew. If you don’t have it…get it. Here’s the terminal command to install it:
/bin/bash -c “$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/HEAD/install.sh)
Next, we need to add Homebrew’s /bin and /sbin directories to your terminal’s PATH environment variables file so we don’t have to specify the entire file path everytime we want to use Homebrew.