Building for macOS on Linux or Windows
Cross-compiling for mac requires that the macOS SDK is available to link against. When building from a Linux or Windows computer, we must download and install the SDK and also update our build toolchain to use it. The easiest way to do this is with the osxcross tool. The details for this setup can be found in the Cross compiling for macOS with CGo section of an Appendix, Cross-Compiler Setup. The main steps are outlined here for quick reference using a Linux terminal—the Windows setup is similar once you have installed the cygwin or mingw terminals.
First, we need to download the macOS SDK, which is bundled with Xcode. Download XCode.dmg from the Apple download site at https://developer.apple.com/download/more/?name=Xcode%207.3 ...
Become an O’Reilly member and get unlimited access to this title plus top books and audiobooks from O’Reilly and nearly 200 top publishers, thousands of courses curated by job role, 150+ live events each month,
and much more.
Read now
Unlock full access