Skip to content

Building one Windows binary left 1.4 GB of MinGW on this Mac

Cross compiling for Windows or Linux installs a whole second toolchain. Measured: mingw-w64 at 1.42 GB, with nothing else depending on it.

4 min read

To build a Windows executable on a Mac you need a compiler, linker and C library that target Windows. That is a complete second toolchain, and it stays installed long after the one project that needed it.

Why it is so large

MinGW ships the GCC compiler, binutils and the Windows C runtime, built separately for 32-bit and 64-bit Windows. Two targets, each with headers and libraries for the whole Windows API, is where the size comes from.

It usually arrives with a language toolchain that targets Windows. On this Mac, the Rust toolchain had the x86_64-pc-windows-gnu and x86_64-pc-windows-msvc targets added, and the GNU one needs MinGW to link. Those target libraries are extra space of their own, inside ~/.rustup.

Check yours

du -sh /opt/homebrew/Cellar/* | sort -h | tail -10
brew uses --installed mingw-w64

# Extra compile targets, if you use Rust
rustup target list --installed

Removing it

brew uninstall mingw-w64

# And the matching compile targets you no longer build for
rustup target remove x86_64-pc-windows-gnu x86_64-pc-windows-msvc

The same applies to other cross toolchains: arm-none-eabi-gcc for microcontrollers, musl-cross for static Linux binaries, llvm when installed alongside Xcode's own. A CI service that builds on the target platform is often the better home for them. More in Homebrew packages taking up space and Rust and Cargo taking up space.

Related: ESP-IDF taking up space on Mac.

Common questions

How big is mingw-w64 on a Mac?

On the Mac measured, 1.42 GB in Homebrew, the largest single package installed.

Is it safe to uninstall mingw-w64?

Yes, if brew uses --installed mingw-w64 lists nothing and you no longer build for Windows. It only affects cross compiling.

Why was mingw-w64 installed?

Usually to link Windows builds from a Mac, for example the x86_64-pc-windows-gnu target in Rust.

What other cross compilers take up space?

arm-none-eabi-gcc for embedded work, musl-cross for static Linux builds, and extra rustup targets, each a separate toolchain.

Read next