Installing Swift on Windows 11
November 08, 2024

TL;DR – use the winget method to install everything

I recently set up a virtual machine running Windows 11, on an M1 Studio Mac.

I wanted to test Windows builds of various Swift packages on it, so the first order of the day was to install Swift.

I went to the Windows installation instructions on the Swift website and started downloading and running installers, including the Visual Studio one.

Lots of downloads later, I tried to build a swift package, and hit an error could not build C module 'SwiftShims' which was a clear indication that I’d somehow cocked up the installation.

I tried to reinstall AllTheThings, but couldn’t fix the issue.

Eventually I noticed that there was an alternative set of instructions on that page, for doing the install on the command line using WinGet.

Long story short: use this method!

After uninstalling everything I’d manually installed, and following the winget instructions, everything is up and running fine.

I’m not sure why this method isn’t given more prominence, as it’s clearly more deterministic and harder for a mere human to mess up!

« Xcodebuild, Plugins and Platforms
Got a comment on this post? Let me know at @samdeane@mastodon.org.uk.