kubkon/zig-ios-example
{ "createdAt": "2021-08-06T10:37:09Z", "defaultBranch": "main", "description": "Minimal build.zig for targeting iOS", "fullName": "kubkon/zig-ios-example", "homepage": null, "language": "Zig", "name": "zig-ios-example", "pushedAt": "2023-10-11T19:51:54Z", "stargazersCount": 143, "topics": [], "updatedAt": "2025-11-03T18:37:58Z", "url": "https://github.com/kubkon/zig-ios-example"}zig-ios-example
Section titled “zig-ios-example”Minimal build.zig for targeting iOS with Zig toolchain.
Building
Section titled “Building”For iOS Simulator on Apple Silicon Mac:
zig build -Dtarget=aarch64-ios-simulatorFor iOS Simulator on Intel Mac:
zig build -Dtarget=x86_64-ios-simulatorIf you are building natively on macOS and have Apple SDKs installed for Apple platforms, the path
to the SDK will be autodetected for you as part of the build script. You can still manually set the
path to the SDK via --sysroot flag.
If you are cross-compiling from a different host such as Linux, or you don’t have Apple SDKs installed
on macOS, you will need to provide the appropriate Apple SDK such as iphoneos if targeting hardware
devices or iphonesimulator if targeting the simulator. In this case, you will need to provide the path to
the SDK explicitly using the --sysroot flag.
Setting the sysroot looks like this
zig build --sysroot <path_to_sdk> -Dtarget=aarch64-ios-simulatorRunning in iPhone Simulator
Section titled “Running in iPhone Simulator”Fire up the simulator, and then install the app with
xcrun simctl install booted zig-out/bin/MadeWithZig.appYou can run the app with
xcrun simctl launch booted madewithzigWIP: running on an iPhone
Section titled “WIP: running on an iPhone”This is more of a roadmap what I’d like the process to look like. For now, this only works for me
locally as I am in possession of Jakub’s secret sauce! However, I am working hard on making both
zignature and zig-deploy
more complete and actually functional for others, so stay tuned for updates!
zig build -Dtarget=aarch64-ios.15.4...15.4zignature -s <path-to-cert> --entitlement <path-to-entitlements.plist> zig-out/bin/MadeWithZig.appzig-deploy -n <name-of-your-device> zig-out/bin/MadeWithZig.app