The XNU kernel has been open source for a very long time.
https://en.wikipedia.org/wiki/XNU
Note that this is not the full operating system/windowing system, it's just the kernel.
https://en.wikipedia.org/wiki/XNU
Note that this is not the full operating system/windowing system, it's just the kernel.