macOS: UNIX or Not?

This subject raises a bunch of different questions. What is the lineage of macOS? How much of that hereditary material is still present in today’s macOS, and does it matter? Before we can begin to answer whether something is UNIX, Unix, or Unix-like, we need to be comfortable with what those terms mean. Who gets to decide if something is Unix or UNIX, and what criteria do they use?

Let’s start at the beginning.

Unix was created fifty years ago at Bell Labs, a research and development company owned by AT&T. Fast-forward to 1973 and Version 4 of Unix, which was rewritten in the C programming language. This made the operating system much more portable and easier to transfer to different hardware platforms. That same year, Ken Thompson and Dennis Ritchie, two of the core Unix architects, presented a paper at a conference about operating systems. Immediately they received requests for copies of the operating system.

Bound by a consent decree that dated back to 1956, AT&T had to eschew “any business other than the furnishing of common carrier communications services.” Unix didn’t qualify as something AT&T could profit from. So, the company did something remarkable for that time: distributed Unix as source code with a liberal license. Small charges covered the shipping and packaging and a “reasonable royalty.”

A Proliferation of Unixes

Because Unix was provided “as-is,” it came without support. As a result, a Unix community began to coalesce to help members, and patch and extend Unix. So, you could get the source code, modify it, and get support from the community. That’s got a familiar ring to it. Different flavors of Unix began to appear, adapted and tweaked to suit the organization doing the work.

Bob Fabry, a computer science professor at UC Berkeley, was on the program committee for the 1973 Symposium on Operating Systems Principles. He listened to a presentation by Thompson and Ritchie, entitled The UNIX Time-Sharing System.

Fabry requested a copy of the operating system, and, in 1974, Unix was installed on a PDP/11 at the Computer Sciences Research Group (CSRG) at UC Berkeley. Significantly, Ken Thompson spent a year there, working on what quickly became the university’s own flavor of Unix. Copies of the UC Berkeley changes and additions were distributed and became known as the Berkeley Software Distribution (BSD). Eventually, these became distributions of an entire Unix system, still known as BSD. Version numbers, such as 4.2BSD, identified the different releases.

In 1984, AT&T was released from the strictures of the 1956 consent decree and able to market its operating system properly. It included BSD code, such as TCP/IP, vi, and the C shell, csh. Even with this cross-pollination and collaboration, there were difficulties with licensing. BSD contained AT&T code, which was not open source, but the BSD elements were.

A version of BSD without AT&T code was developed to get around these issues. When the AT&T code was removed, though, about 20 percent of the kernel was missing. William Jolitz wrote the missing portions, and that version of Unix was released as 386BSD. The 386BSD project stalled, but in 1993, its source code base gave rise to the NetBSD and FreeBSD projects.

That’s given us one piece of the jigsaw: FreeBSD.

NeXTSTEP

After he was fired from Apple, Inc. in 1985, Steve Jobs founded a company called NeXT, Inc. To provide an operating system for its workstation product line, NeXT developed NeXTSTEP. It used BSD as a codebase but introduced a completely different kernel.

NeXT used a modified version of the Mach microkernel and 4.3BSD to form NeXTSTEP, which is the second part of this jigsaw. Mach was developed at Carnegie Mellon to facilitate research into distributed and parallel computing. The research team used BSD as the operating system and replaced the kernel rather than writing their own operating system.

XNU

In 1996, Apple, Inc. bought NeXT, Inc. and, thereby, acquired NeXTSTEP. Apple started developing the operating system that would finally become macOS by way of Mac OS X. It upgraded the Mach kernel and replaced it with the more advanced version the Open Software Foundation developed and used in the OSF/1 operating system. Apple also upgraded the BSD components with updated and improved versions from the FreeBSD distribution.

Apple brought elements of the BSD kernel back into the Mach kernel. It also developed a hybrid kernel that combined characteristics of both monolithic and microkernel architectures.

The I/O Kit, which Apple developed based on NeXTSTEP’s DriverKit, was also included. This made it possible to add drivers to a kernel without having to modify it each time.

XNU is the third part of the jigsaw.

The POSIX and SUS Standards

In 1996, two standards bodies—X/Open and the Open Software Foundation—merged to form The Open Group.

The Open Group is the certifying body for the UNIX trademark. In other words, it has to rubber-stamp your operating system as compliant to its standards before you can call it UNIX. UNIX in all uppercase letters is the badge of compliance.

So, the categories are as follows:

Unix: A family of operating systems. This family includes both UNIX operating systems and Unix-like operating systems. UNIX operating systems: These have been certified as compliant to the standards. Unix-like operating systems: These look and operate like Unix, but haven’t been certified as compliant.

It’s entirely possible, of course, that some operating systems in the “Unix-like” category could be tested tomorrow and found compliant. These are effectively UNIX now, but they can only be categorized as Unix because they don’t yet have the rubber-stamp.

There are two standards that certify UNIX: POSIX and Single UNIX Specification (SUS). SUS is a superset of POSIX. So, something can be POSIX compliant, but that doesn’t make it UNIX. However, if something is SUS-compliant, it’s a UNIX.

POSIX and the SUS form large collections of documents (around 3,700 pages). They define the operation and expected behavior of every aspect of a compliant UNIX system. Everything from asynchronous and synchronous I/O, to the scripting interface and user-level programs are cataloged and defined.

The standards define application interfaces and run-time behavior, but they don’t dictate how they’re implemented.

So, Is macOS UNIX?

The answer has to be yes.

You can trace its lineage back through FreeBSD to BSD, and from there, back to the Unix distributed by Bell Labs before the license fee increase from AT&T.

But that doesn’t matter.

If you write an operating system from scratch right now, as long as it satisfies the requirements of the SUS, it’s considered UNIX. And it doesn’t matter how you implement it. The XNU kernel at the heart of macOS is a hybrid architecture. It combines Apple’s code with parts of the Mach and BSD kernels.

But that doesn’t matter, either. What matters is it meets the requirements of the standards against which it’s measured.

The BSD part of the XNU kernel provides the POSIX application programming interfaces (such as the various API and BSD system calls). Keeping that element of the BSD kernel intact within XNU is key to gaining certification as a UNIX. It allows XNU to speak compliant and compatible UNIX to the rest of the system.

macOS is a UNIX 03-compliant operating system certified by The Open Group. It has been since 2007, starting with MAC OS X 10.5. The only exception was Mac OS X 10.7 Lion, but compliance was regained with OS X 10.8 Mountain Lion.

Amusingly, just as GNU stands for “GNU’s Not Unix,” XNU stands for “X is Not Unix.”