6

I think that Mac OS X is based on the Darwin OS, and the Darwin OS is based on the NeXTSTEP OS.

Am I correct?

  • 6
    You might want to rephrase this in a more exact way about what parts and which aspects you refer. Otherwise this question is way to broad and unclear. Any OS is based on multiple influences, not just a single source (also consider that Darwin is just a kernel which (in its Nextstep counter part/origin) is itself a BSD 4.3 derivative) – Raffzahn Mar 3 at 23:35
  • 1
    @Raffzahn, The NeXTStep kernel was derived from the Mach OS kernel, which was developed in the 1980s at Carnegie-Mellon University. I have no comment on the user-mode code in NeXTStep and in Mach, but the Mach kernel code was completely new at the time. (I.e., not derived from any previous Unix release). – Solomon Slow Mar 4 at 15:17
  • 2
    Avie Tevanian is probably the key person to look up re: Mach; he was the principle designer at Carnegie Mellon, which is how he ended up at Next working on the same thing, and eventually a VP at Apple until 2003. So there's a direct continuity of the person doing the work. – Tommy Mar 4 at 16:12
  • 4
    What information in en.wikipedia.org/wiki/MacOS#History do you need explained more? What other information have you found? The history ios quite long and does not really fit into a simple answer – user151019 Mar 4 at 17:10
10

The short answer to the question is yes. macOS (as it is now called) is an evolution of NextStep. However, there is probably not very much original NextStep code left in it today.

NextStep was an operating system created by taking the mach microkernel to provide low level services such as virtual memory, context switching, task synchronisation and others and fusing it with the BSD 4.3 Unix device driver system, virtual file system and network stack. Added to this was the BSD device API (i.e. Unix special files) to allow user programs to interact with devices. Although mach is technically a microkernel, NextStep put all of the above in kernel space with mach for performance reasons.

On top of the kernel was the BSD userland which consists of the command line utilities and other system level stuff that operates in user space such as the daemons and init system.

On top of all this was the graphical subsystem which was responsible for managing the user display. This was written in Objective-C and corresponds to Cocoa in macOS. In fact, the legacy of NextStep is still visible in that all the Cocoa classes start with the prefix "NS" for NextStep.

At the time when Next were trying to sell Next cubes ands NextStep, Apple were in trouble. Their operating system MacOS (not to be confused with macOS) was showing its age. It had no pre-emptive multitasking and memory protection was mediocre. On a technical level, it was not much further advanced than Windows 3.1 which had been obsolete for over five years when OS X was released.

Apple had a couple of abortive attempts to create a replacement for MacOS before they bought Next. Having bought Next, they decided to modify NextStep as the new OS. Changes they made include:

  • completely replacing the device driver system with a new one written in a restricted subset of C++ that better supported plug and play
  • changing the look and feel of the graphical objects in the display subsystem
  • porting HFS+ to the virtual file system
  • Creating the Carbon API that allowed existing Mac apps to be recompiled for macOS with minimal changes
  • Adding a "Classic" subsystem to allow legacy MacOS apps to run without recompilation.

Over the next few years they gradually rewrote a fair amount of the BSD kernel subsystems because the BSD code was frankly dire. (I know from experience. In the mid 2000's I had a job to port a WORM drive file system to macOS which meant writing a virtual file system driver for it). For example, in BSD 4.3, mutual exclusion in the kernel was achieved by means of a thing called the thread funnel. The thread funnel was a global lock that stopped anything in the kernel from running except the thread that owned it. That's fine on single core machines but caused an unnecessary bottleneck on multicore machines. So the thread funnel was replaced in (IIRC) 10.4 with more conventional synchronisation primitives.

Also in the 10.4/10.5 time scale, they started abstracting the virtual file system and network stacks to make the kernel API to each much cleaner ands easier to program for. It's probable they have continued that work and not much of the BSD code exists anymore.

Darwin, by the way, is just a name given to the Open Source portion of macOS. This consists of the kernel and the BSD user land. It was not developed first and then macOS developed from it. In fact, it probably goes the other way historically.


Reading the comments on Dr Sheldon's answer, I see there is some confusion about names. So here is a little glossary of relevant terms:

  • MacOS: The original Macintosh operating system
  • NextStep: the operating system for the Next Cube
  • Mac OS X: Apple's new operating system based on NextStep
  • macOS: A rebranding of the version of OS X that runs on Macintoshes (as opposed to phones, watches and TVs)
  • BSD: Berkely Software Distribution - a flavour of Unix
  • XNU: The kernel for NextStep and OS X. XNU consists of the Mach microkernel and some BSD 4.3 kernel subsystems. On OS X it also contains the C++ device driver subsystem.
  • Darwin: An operating system consisting of the Open Source parts of OS X.
  • Cocoa: The primary Objective-C GUI subsystem
  • Carbon: a framework written in C that provides source level compatibility for MacOS apps on OS X
  • Potentially true trivia fact: a large portion of Carbon predates Apple's acquisition of Next, coming from the Windows version of QuickTime. This is a story popularly told and which has managed to elevate itself to Wikipedia inclusion, ensuring it will survive for a while longer. Though nobody actually seems to have a citation for it. – Tommy Mar 4 at 15:28
  • @Tommy That's interesting if true. I had assumed it was ported from MacOs but I have no evidence to support that. – JeremyP Mar 4 at 18:52
  • So the apocryphal version goes, the Mac OS code was so heavily tied up in assembly language and jumping through various accumulated hoops that the small parts of the Toolkit that they'd ported to Windows for QuickTime were easier to start from. – Tommy Mar 5 at 14:58
  • "Apple had a couple of abortive attempts to create a replacement for MacOS before they bought Next." Described here: en.wikipedia.org/wiki/Copland_(operating_system) – snips-n-snails Mar 5 at 19:29
4

In case a dry restatement of the chronology helps to resolve the confusion:

NeXT Computer was acquired by Apple in 1997. At the time NeXT's most successful product was WebObjects, the Objective-C/Java server product; the NextStep OS had turned into OpenStep in partnership with Sun but the latter had drifted away after deciding to push Java as the solution for everything.

Rhapsody was both announced and demoed by Apple in 1997, one month before it completed acquisition of NeXT; it was subsequently made available to the public as two Developer Previews, the first in 1997 and the second in 1998. It provides a wonky emulation of the MacOS 8 look and feel atop the NeXTStep stack of the Mach kernel plus a BSD subsystem, with two 'boxes' for applications — the yellow box provides a version of the OpenStep libraries, for fully-native apps, and the blue box provides MacOS 8 in a box. Literally in a box; all MacOS 8 applications ran within a single common window, much like the experience you usually get running a virtual machine. A Java Virtual Machine is offered, but as with the two boxes that's once again a separate thing, in its own little API world.

From there Apple moved to OS X Server 1.0 in 1999. It still looks like MacOS 8, though it's still a reimplementation so the widgets don't always act identically, with NeXTStep-esque Display Postscript as the graphics layer, the NextStep Workspace Manager as the desktop, and classic Mac applications constrained within their own little desktop-in-a-window.

Darwin was also born in 1999, then being the kernel plus the BSD subsystem plus other parts that Apple publicised as producing a complete operating system with Apple's driver model. Over time it has sometimes tracked core OS X developments — e.g. switching to CUPS, gaining libdispatch — but it'd be out of scope to discuss more modern developments too thoroughly; see old release notes for evidence of its scope during the relevant period, and note that not everything Apple provided in its compiled versions of Darwin was provided as open source. So the popular version of events — that Darwin is the open source parts of OS X — also isn't completely accurate.

OS X 10.0, the first consumer-targeted release but still looking and acting a lot like a beta, didn't arrive until 2001. Significant changes:

  • the Aqua user interface, in its lickable phase, has arrived;
  • as has most of the rest of early OS X: Aqua implementations of the Finder, the Dock, and the menu bar;
  • classic applications are no longer constrained to a box;
  • Carbon has been added as a native framework (and, similarly, is available for the Classic OS) to provide the migration path necessary to retain the support of Adobe, Microsoft et al;
  • as per the history with Sun, the Java bridge is present, providing Java with the same access to Cocoa as Objective-C; and
  • various remnants of NextStep survive that will later disappear: the pre-CoreText font rendering system being probably the most prominent.

So to directly answer your questions:

  • Darwin underpins macOS/OS X; but
  • public OS X releases predate Darwin releases by two years; and
  • there is a visible technological evolution in OS X during which direct NextStep components are slowly replaced (the Workspace Manager's mutation into the Aqua desktop via MacOS 8 controls being an obvious example), though none of those components are provided in Darwin.

So I think it's most accurate to say that OS X is the descendant of NextStep, albeit quite far removed by the time — four years after NeXT's acquisition — that it finally became a consumer product, and Darwin is a spin-off of OS X.

(and if I've been inconsistent in my capitalisation of NeXT/Next, it's because the company was famously indecisive)

  • Re: Darwin as "complete OS". I think it appropriate to say that that never materialised in any meaningful form for users. "One current goal of this project is to provide a useful bootable IMG –– This is not a full OS like PureDarwin Xmas was, as Apple have closed down a lot of core components, we the community have to pick up the slack." -> Darwin is just an excuse, a fig leaf, so the company can continue to claim it has a FOSS & Unix foundation (and downplay its GPL3 allergy) Q: What components of these Darwin tools are actually used in 10.14? – LangLangC Mar 4 at 16:38
  • @LangLangC "Fig leaf" feels very aggressive — if you've used any WebKit browser, or any application at all built with LLVM or Clang then you've benefitted from work Apple bankrolled — but otherwise, Darwin was fully bootable back in the day, see e.g. web.archive.org/web/20160405162456/https://opensource.apple.com/… which is "the first Darwin release with a bootable PowerPC image" and even "contains binary versions of certain non-open source drivers". – Tommy Mar 4 at 17:00
  • I'm also going to decline to get into Darwin's current relationship with 10.14 as the question is of origins and the site is about retro computing. I see I've already suffered from poor editing there so I'll just make the change to make it explicit that the provided timeline ends in 2001. – Tommy Mar 4 at 17:01
  • 1
    @LangLangC done. I went with 'publicised as' rather than 'claimed', but whatever. – Tommy Mar 4 at 17:44
  • 1
    "It provides a wonky emulation of the MacOS 8 look and feel atop the NeXTStep stack" - which was, nevertheless, surprisingly functional. It took a while for macOS to get back to that level of functionality. – Maury Markowitz Mar 5 at 20:08
2

I will add a bit to the stories above.

A key issue is the difference between NEXTSTEP (yes,all caps), OPENSTEP and OpenStep.

NEXTSTEP (NS) was the original system on the NeXT platform, and its UI, and it's programming system. I have yet to work on another machine that is even remotely as integrated as this system was in the early 1990s - one might compare to VisualStudio under .Net, but even then .Net has a profusion of different libraries and systems whereas in NeXT there was generally one way to do something and it often did what you wanted in the first place.

When the machines basically stopped selling, NeXT began a porting effort to run NEXTSTEP on new platforms, initially the 88000. As the 88k floundered, they took a wider view and decided to port it to basically any RISC platform. This, in turn, led to partnerships with other vendors which became OpenStep (OS). OS is essentially NEXTSTEP with the underlying OS separated out so that it could (theoretically) run on any reasonably Unix-like OS. To do this, calls to the operating system that were baked into the original NS system were separated out into a compatibility later, and a number of basic objects went with it, including things like NSString, so they could be implemented on those platforms. One of those platforms was the original NeXT boxes (and planned RISC replacements), in which case it was very confusingly referred to as OPENSTEP as a replacement for NEXTSTEP.

It was this later system, OpenStep, that forms the basis of the modern macOS. This is why earlier versions of Cocoa had Foundation and AppKit, which were the two layers of OS. These were slowly re-merged (through developer-kit-level tricks) and under Swift are largely invisible.

I remain of the opinion that Cocoa/OpenStep/NEXTSTEP remains the best development system I've touched. In .Net I'm constantly cursing even the most basic objects for what amounts to lazy design, obvious missing features, and too many sub-par ways to do something when all you need is one good way. Even with all the tribulations of Swift (which I consider a complete mistake) and the performance issues and bugs of Xcode, development on the mac remains a joy.

1

When Apple purchased the company NeXT in 1997, they got not only CEO Steve Jobs from the deal, but also the smaller company's technologies. This included NeXTSTEP, the Unix-based operating system for NeXT machines.

Under Jobs' leadership, Apple then modified NeXTSTEP to work on Macintosh hardware. The result was MacOS X. Some Apple technologies were retained (e.g. QuickTime), whereas many others (many of which were seldom used anyway) were discarded. In addition, Apple tried to keep backwards compatibility with the Classic run-time environment and the Carbon source-code API.

Darwin is the kernel plus the low-level layers of MacOS X. There is enough in Darwin that it could act as an operating system, but much of the usefulness of MacOS X is in the higher layers. Darwin is open source, but the higher layers of MacOS X is not.

  • 1
    Now, since everything remarkable about Nextstep were the layers above the kernel, which was a rather common BSD 4.3, and none of these components made it into Mac OSX, it's not much of a heritage line to draw here. Or with simple words - Only the quite standard BSD kernel made it into OSX - all above layers, not just some, are ported from Mac OS. – Raffzahn Mar 3 at 23:41
  • 1
    Based on this page: en.wikipedia.org/wiki/Darwin_(operating_system), Darwin is an OS and not a kernel, the page also says that the kernel for the Darwin OS is XNU (which I think is also the kernel for Mac OS X). – user12035 Mar 3 at 23:43
  • 4
    @Raffzahn Objective-C (OS X’s primary application development language) and Cocoa (its standard library and application-level APIs) came from NeXTSTEP, not Mac OS (hence the NS prefix on many class names). – NobodyNada Mar 4 at 1:04
  • 2
    @user12035 XNU is the kernel, Darwin is the BSD Unix-based OS built on (and including) the XNU kernel. – NobodyNada Mar 4 at 1:06
  • 2
    @SolomonSlow prior to Xcode's introduction circa 10.3, the provided development tools were the two separate items of Project Builder and Interface Builder, both exactly NextStep carry-overs. But I tend to view OS X as more of a logical evolution of NextStep than necessarily a port: e.g. it ejects Display Postscript (which needed to be licensed) in favour of what-still-effectively-is-but-hasn't-been-called-for-years Display PDF (i.e. exactly the same primitives and semantics as Display Postscript, but no interpreted language). – Tommy Mar 4 at 15:32

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.