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?
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?
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:
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:
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:
So to directly answer your questions:
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)
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.
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.