Cross compiling from x86_64-darwin to aarch64-darwin

I have a feeling the answer to this will be a resounding no, but is there any way to cross compile (or emulate) aarch64-darwin on x86_64-darwin?

I have a single Nix configuration for my two laptops: personal is Intel and work is ARM. I’d like to be able to run nix flake check on my Intel laptop or on CI, for example, without needing to use a Mac with an M1. Is this even possible? I think the answer is no, but I wanted to double check before giving up on CI for at least that portion of my configuration.

2 Likes

Even if you cross-compile, that’s a completely different derivation than a native compile on the target arch. It won’t really let you do what you wanted to do here.

On linux, it’s possible to “natively” compile for an arch you don’t actually have, through binfmt_misc and qemu, but I don’t know if there’s an equivalent on darwin.

1 Like