
Open Terminal on a Mac and you're in a Unix system. ls, grep, ssh and curl are all there, and the operating system is certified as UNIX by The Open Group. That's not a coincidence or a compatibility layer. It's the foundation, and it was built from open source.
How Apple got there, and what it has given back since, is a more interesting story than either "Apple stole open source" or "Apple loves open source."
NeXT
The story starts with Steve Jobs being forced out of Apple in 1985. He founded NeXT, and NeXT built NeXTSTEP, an operating system that combined two pieces from the academic world:
- Mach, a microkernel research project at Carnegie Mellon University.
- BSD Unix, from the University of California, Berkeley, for the Unix interfaces and tools.
On top, NeXT put an object-oriented development environment built on Objective-C that was years ahead of its time. Tim Berners-Lee wrote the first web browser on a NeXT computer.
By the mid-1990s Apple's own operating system was failing. Its next-generation project, Copland, had collapsed. In December 1996 Apple announced it would buy NeXT, and the deal closed early in 1997. Jobs came back with it, and NeXTSTEP became the basis of Mac OS X, released in 2001.
What's underneath
- XNU ("X is Not Unix") is the kernel. It's a hybrid of Mach and parts of the FreeBSD kernel, plus Apple's own driver framework.
- Darwin is the open source operating system underneath macOS: XNU plus the BSD userland and core libraries. Apple publishes its source, under the Apple Public Source License and others.
- The command line is mostly BSD: FreeBSD-derived tools, which is why
sed -ibehaves differently on a Mac than on Linux.
On top of Darwin sit the proprietary layers: the graphics stack, the Cocoa frameworks that descend from NeXTSTEP, and the applications. Those are closed, and they're what makes a Mac a Mac.
What Apple gave back
It's a fair list, and longer than critics usually allow:
- WebKit. Apple forked the KHTML rendering engine from the KDE project in 2001 and released Safari's engine as WebKit in 2005, under open source licenses. Google built Chrome on WebKit before forking it as Blink in 2013, which means nearly every browser engine in use today descends from that decision, except Firefox's.
- LLVM and Clang. Apple hired Chris Lattner in 2005 and put serious money behind the LLVM compiler project and its C-family front end, Clang. Today LLVM is the basis of the Rust, Swift and many other compilers, and Clang is a full alternative to GCC. It may be Apple's most consequential open source contribution.
- Swift, open sourced in 2015, runs on Linux.
- CUPS. Apple hired the author of the Common Unix Printing System and bought its rights in 2007, and the Linux printing stack has run on it ever since.
- Darwin and the open source parts of the OS are published with each release.
What Apple walked away from
Apple's relationship with the GPL tells you a lot about how it thinks.
The GNU General Public License version 3, published in 2007, added terms about patents and about devices that refuse to run modified software. Apple won't ship GPLv3 code. So the company froze or replaced every GPL component when it moved to version 3:
- bash stayed at version 3.2, a 2006 release, for more than a decade, because newer versions are GPLv3. In 2019 macOS Catalina made zsh, under an MIT-style license, the default shell instead.
- Samba was removed in 2011 and replaced with Apple's own SMB implementation.
- GCC was frozen at an old version and then replaced by Clang.
That's legal. Apple was always free not to use GPLv3 software. But it shows where the line is. Apple uses and contributes to permissively licensed open source, where it keeps control of its products, and avoids copyleft, where it wouldn't.
Darwin has also become less useful as a standalone open source system over the years. Some components show up late or not at all, and community efforts to build a bootable Darwin distribution have struggled.
So, fair or not?
Apple took a lot from open source. It built its operating system on code written at Carnegie Mellon and Berkeley, and it still ships hundreds of open source components. It also gave back things that changed the industry: WebKit, LLVM, Clang, CUPS and Swift.
The pattern is consistent. Apple open sources what makes the platform stronger, and keeps closed what makes the Mac distinctive. You don't have to like that. But "Apple stole Unix" isn't fair either. Permissive licenses like BSD's exist precisely to allow what Apple did, and the people who wrote them knew it.
If you're a Linux user on a Mac, the practical lesson is to install GNU tools through Homebrew, check your sed and grep flags, and remember that the Unix underneath is a cousin, not a twin.