They use FreeBSD and Darwin open-source code. Darwin is the core of MacOS with the XNU/MACH Kernel. So they are doing nothing wrong that Apple can sue them over it. The trick is writing the code that does what the Non-Open-Source code of MacOS does to run the Mac Apps.