Preface

Although Apple Computer ushered in the PC revolution in 1980 with the Apple II computer, the inventions that are most synonymous with the company are the Macintosh computer and its ground-breaking graphical operating system, both released in 1984. Let’s think of this operating system as Mac OS 1, though Apple wouldn’t coin the term “Mac OS” to describe its operating system until the 1990s. The early Mac made its mark in a world where all other popular computer interfaces were obscure.

In the years following the Mac’s release, much has changed. Both bad and good things have happened, and some company in Washington called Microsoft started to take over the world. By 1996, Apple knew it needed to modernize the Mac OS (and make it more worthy competition to Windows) from the bottom up, but previous attempts and partnerships to bring this about had ended in failure. So, it made an unusual move and purchased NeXT. This company had made a nice Unix-based operating system called NeXTSTEP, in which Apple saw the seeds of its own salvation. As it happened, NeXT’s leader was the ambitious Steve Jobs, one of Apple’s founders, who left the company after a political rift in the 1980s. To make a long and interesting story short, Jobs quickly seized control of Apple Computer, stripped it down to its essentials, and put all its resources into reinventing the Mac. Five years later, the result was Mac OS X: a computing platform based around an entirely new operating system that merged the best parts of the old Mac OS, NeXTSTEP, and nearly two decades of user feedback on the Mac OS.

Mac OS X initially may seem a little alien to long-time Mac users; it is, quite literally, an entirely different operating system than Mac OS 9 and earlier versions (even though Mac OS X retains most of its predecessor’s important interface idioms, such as the way the desktop and the user interface works, as covered in the first two chapters of this book). However, the Mac is now winning more converts than ever, not just from Windows, but from other Unix systems such as Linux, Solaris, and FreeBSD (from which Mac OS X’s Unix core is derived).

Mac OS X brings all of the great things from earlier versions of the Mac OS and melds them with a BSD core, bringing Unix to the masses of the world. Apple has created a rock-solid operating system to compete both on the user and enterprise level. In days gone by, the Mac was mostly looked at as a system for “fluffy-bunny designers.”[1] It’s now becoming the must-have hardware (for example, the TiBook) and operating system of geeks and designers everywhere.

With Mac OS X, you can bring home the bacon and fry it up in a pan. Your Mac can be used not only for graphic design and creating web pages, but also as a web server. Not into flat graphics? Fine, Mac OS X sports Quartz Extreme and OpenGL. Want to learn how to program? Mac OS X is a developer’s dream, packing in Perl, Python, Ruby, C, C++, Objective-C, compilers, and debuggers; if you’re an X jockey, you can also run X Windows on top of Mac OS X if you really want or need to. In addition to the standard programming languages, Mac OS X comes with a powerful set of frameworks for programming with Cocoa, Mac OS X’s native language (adopted from NeXT).

The Layers of Mac OS X

As mentioned earlier, Mac OS X is a multilayered system, as shown in Figure P-1. At its core is the Kernel Environment , or Darwin (http://opensource.apple.com/darwin), Apple’s own open source operating system, which is based on the Mach 3.0 microkernel and BSD 4.4 Unix. Darwin gives Mac OS X its Unix core, along with features such as a protected memory environment, support for multithreaded applications, and stability that just wasn’t attainable in earlier versions of the Mac OS.

The layers of Mac OS X

Figure 1. The layers of Mac OS X

Next up, we have the Core Services layer. The Core Services provide a set of application program interfaces (or APIs), which allow applications to speak with and take instructions from the kernel. Unless you’re a developer, the Core is something that you’ll never have to touch or deal with. For programmers, though, the Core provides access to such things as Core Foundation, Core Graphics, Core Audio, CFNetwork, Carbon Core, and Apple Events, to name a few.

The Application Services layer gives Mac OS X its slick Aqua interface. The components in this layer include Quartz Extreme (which replaces QuickDraw from earlier versions of the Mac OS), QuickTime, and OpenGL. Quartz Extreme draws and renders graphics, performs anti-aliasing, and provides services for rendering and printing PDF. Quartz actually has two components: the Quartz Compositor and Quartz 2D. The Quartz Compositor is the window server, while Quartz 2D provides a set of APIs for rendering and drawing two-dimensional shapes.

OpenGL—the work horse of the graphics community—provides services for three-dimensional (3D) graphics. If you’ve played any of the games created in the last 10 years or so, chances are they were based on OpenGL. QuickTime is used in the OS to handle multimedia, such as streaming graphics and movies. Quartz, OpenGL, and QuickTime work together to render all you see in the graphical world of Mac OS X.

On top of it all, we have the Application Environment . This final layer is where you do all your work, and is where the applications are run. Apple provides two native APIs for applications to run on Mac OS X: Carbon and Cocoa. Carbon applications are older C and C++ applications that have been Carbonized to run natively on Mac OS X. Cocoa is Mac OS X’s “pure” environment: Cocoa applications rely only on the frameworks provided by the system, and not on an older code base.

The application environment contains a pure Java system—not a virtual machine, as in older Mac systems—which allows you to run 100 percent-pure Java applications on Mac OS X. The current implementation is J2RE SE 1.3.1_03-69; however, as Jaguar proved, things will change, so you should expect Apple to improve the Java implementation as time goes by.

If you have an older Mac application that hasn’t been Carbonized and isn’t Cocoa- or Java-based, you’re not out of luck. If your system also has Mac OS 9 installed (9.2.2 to be exact), you can run older Mac applications in the Classic Environment (or just Classic). When you’re running Classic, you’re basically running a watered-down implementation of Mac OS 9 on top of Mac OS X. Classic is covered in Chapter 3.

Also running at the application layer is the Terminal application (/Applications/Utilities), which is your command-line interface to the Unix shell. For users, the default shell is tcsh, and in Jaguar, the default shell for handling shell scripts is sh (the default for shell scripts in earlier versions of Mac OS X was zsh).

This multilayered architecture gives Mac OS X its power and elegance. Each layer—and in some cases, the components within each layer—is independent from the other, resulting in a system that hardly ever crashes.



[1] A quote from Nat Torkington.

Get Mac OS X in a Nutshell now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.