Jun 29, 2009

Apple Will Never Replace Darwin With Linux

Every few months, the Mac web is bombarded with open pleas to Apple, asking—nay, demanding—that Apple swap out the Mach-based kernel that Mac OS X runs on, XNU/Darwin, with Linux. This, of course, ends in with Apple stoically continuing development of XNU/Darwin while fanboys dry their eyes and limp home after their flamewars. The cycle then repeats itself again a few months later like clockwork. The truth of the matter, however, is that Apple will never replace XNU/Darwin with Linux.

Tearing XNU/Darwin out from OS X and replacing it with Linux would be winding the clock back almost twenty-five years. Mach, which comprises a large percentage of XNU/Darwin's XNU kernel, was a microkernel research project developed at Carnegie-Mellon University in the Eighties, overseen by Avie Tevanian, who usually worked on it while playing Depeche Mode and Tears For Fears and ushered it through various revisions at NeXT and, ultimately, Apple.

This continuity of development has given Apple a tight integration between the kernel, libraries, utilities, and higher-level frameworks. Linux would throw that synergy right out the window, making Apple dependent on an entirely unregulated development team, and forcing Apple to play catch-up with their specific needs after every major upgrade to Linux. Apple would have to hire Linus Torvalds in order to recreate the creator/creation dynamic they have now. And as Linus has stated several times, he'll never go work for a company doing Linux.

Perhaps one reason Linux users bleat so unceasingly for Apple to switch kernels stems from a pre-NeXT project the company ran called MkLinux. MkLinux was a version of Mach running Linux as a process. The project was sponsored by both Apple and OSF/1 and ran on Apple's first generation Power Macs and some early second-generation Power Macs. Performance was about 20% less than a native Linux would have been, but that wasn't the point; Apple was looking at different ways to create a modern operating system in the dark times of Copland before NeXT was even a gleam in their eyes.

After Apple's operating system woes came to a head in 1997, MkLinux was all but forgotten by everyone except the long-time Apple engineers tasked with updating OPENSTEP alongside their NeXT counterparts. It was a non-starter, but it was the first taste of Linux anywhere near a Mac; it would be years later that Linux/PPC or the swatch of PowerPC versions of more popular distributions like Debian, Fedora, SUSE, and YellowDog came to Apple motherboards.

"But wait!" whine the Linux zealots, "Apple uses the BSD kernel in Mac OS X, and that's not under their control!" And so it is not. But the portions of the FreeBSD kernel are only used to fill out Mach, and as such does not constitute a significant portion of the kernel. In fact, Apple's use of BSD code is so minute that it amounts to being a charity project that allows Apple a way of keeping FreeBSD solvent. So Apple is simply not using the FreeBSD kernel, and asking to replace XNU with the Linux kernel is therefore asking something disproportionate to reality and wrong. It completely misses the point, just like Linux itself.

Alongside calls of kernel replacement, Linux zealots often ask for Apple to use the GNU userland. In the beginning of Mac OS X's life, Apple used utilities from FreeBSD, NetBSD and OpenBSD instead of Linux, which was a smart move. For one, with BSD, Apple can take what they want, modify it, and ship without worrying about anything else. That's the glory of the BSD license. It's hands-off and lets you use the code as you see fit unrestrained.

In contrast, the GPL is viral in nature and ties the hands of the developers to a process that dictates distribution of source code with the binaries. You know how Snow Leopard is going to weigh five gigs instead of Leopard's eleven? We'd be talking dozens of gigabytes today if Apple used GNU. Proponents of the GPL may argue that the GPL ensures a flow of new code back into the community, but it's really just a burden to the developer.

Another reason Apple favored BSD over Linux was standardization. Most commercial Unices are genetically related to BSD in some way. For instance, Sun's Unix, Solaris, is a hybrid of System 5 Release 4 and BSD, while IBM's Unix, AIX, is based firmly on BSD4. The same goes for Hewlett-Packard's HP-UX and Tru64 UNIX, SGI's IRIX, and SCO Group's SCO OpenServer and SCO UnixWare. These Unices represent over 97% of the current Unix market, which shows that the BSD family is stronger and more established than SVR4 or the myriad of incompatible Linux distribution offerings.

BSD command utilities, while not universal, are more ubiquitous than the GNU command set, which Linux uses. And while some GNU utilities offer BSD compatibility, it's really a crapshoot whether they'll even compile. By using BSD commands, Apple made sure that a Unix pro could sit down and get to work with their command line. Even though Linux has grown somewhat in popularity, the choice for familiarity and compatibility is still clear. For those who want Linux command tools under OS X, porting isn't a problem thanks to Mac OS X's strong POSIX support.

Apple to this day remains with XNU/Darwin after six (and coming up on seven) major releases of Mac OS X. and are unlikely to switch any time soon. At most, a move to the GNU userland would be feasible, but since that's already available for OS X and BSD, Apple doesn't want mired in the GPL, that's unlikely too. So for the time being, it would be easier on all of us if the Linux-for-Mac OS X camp just quieted down and realized that Mach is what works best for Mac OS X because it offers so much more than Linux.


  1. Seriously, who has ever seriously suggested that Apple would or should replace Darwin with Linux?

    Up next: A six-page dissertation on why a PETA-operated steakhouse would never be financially successful.

  2. Good post. IMHO the Linux kernel is not what any sane company would use for a reliable kernel since the myriad configurations and hacks and add ons (all in some unGodly combination) would throw reliability out the window as well as lose a lot of features we take for granted on Macs these days.

    In general I view the usual "Swap Darwin for Linux" argument as the usual zealot excuse for "I like the Linux kernel, don't know much about it but everyone else should use it" without actually having tried any other kernel or OS like FreeBSD extensively.

    Usually the same people scream how microkernels will slow your computer to a crawl, debugging kernel modules with hard crashes and post-mortem substandard crash dumps is for "real men/programmers [re: masochists]" and that C (and its ilk) is -the- programming language for anyone who programs.

    I've given up even debating the point unless someone has bothered to bench test FreeBSD at least, it's just not worth it.

  3. I could care less about all this crap. I just want features. I use linux for the cutting edge features that I've yet to see in anything else. Where's the decent logical volume management or virtualization in freebsd? I've been waiting for years, and haven't seen anything!
    Linux has lvm and evms. Freebsd has what? Vinum? Vinum is a joke for flexibility. I need to be able to dynamically grow and resize volumes without downtime.
    And what about virtualization? I've long ago lost track of the options available under linux. What does BSD have? Jails...is that it? I know macosx has parallels and vmware fusion, but those are desktop products. Where's the serious server virtualization?

    You guys bitch and moan about Linux zealots, but atleast they're banging out usable features while the bsd guys sit in their corner bashing everyone else.

    Show me the usable features and stop bitching about zealots. And why do I never hear the term BSD or Mac zealots...You guys are just as rabid as the Linux zealots you bash. It's funny, how people hate the people they're the most like :)

  4. It's about using the correct tool for the job, not picking a tool that is inadequate because you like it. I'll admit Linux is ahead of the game when it comes to advanced features, however for some jobs I use FreeBSD instead (or other OSes) simply as they're better suited for the task at hand. Most of the people against not-Linux never have really given it a go to find out if it works for them or not.

  5. I honestly don't know what the capabilities are in Linux, but on recent versions of Mac OS X, you can live resize HFS Journaled partitions if there is enough space to do the move.

  6. Just wondering... take XNU/Darwin and create an GNU-userland around that... who could make such a thing happen?
    - Ralf

  7. hmmm, you rather don't understand the nature of the GPL. please do some more reading on it.

  8. "You know how Snow Leopard is going to weigh five gigs instead of Leopard's eleven? We'd be talking dozens of gigabytes today if Apple used GNU."

    Um... it's actually only if the user requests it. The source needs to be available somewhere, online is sufficient. If the user wants to download it. It really isn't a big deal. If you think about it your way Ubuntu would be a massive 10 - 15 gb install too.

    You don't do fact checks hey?