oreilly.comSafari Books Online.Conferences.


AddThis Social Bookmark Button

Getting to the Source of Mac OS X

by Chris Coleman

When Apple began developing Mac OS X, they did something really cool: they chose BSD Unix as the core foundation for the OS. On top of BSD Unix, they added their programming APIs, Graphics Engine, and Aqua GUI. This is common knowledge. But what many people don't know is that the source code for much of Mac OS X is available to the public.

But Apple didn't open source all of Mac OS X. They kept enough closed to make a very good commercial product while not limiting its usefulness for developers.

Darwin, the base operating system upon which Apple layered its components, is the open source component of Mac OS X. It's based largely on FreeBSD Unix and Mach technologies. Most of this code was already open, and Apple chose to keep it that way. The existing business-friendly license on the code allows Apple to create a proprietary version and maintain an open source version without compromising any of their intellectual property.

Darwin Can Stand on Its Own Two Feet

Since Darwin is there working all the time beneath the Aqua interface, this Unix-based core of Mac OS X can be accessed directly using the Terminal application. Apple has even taken things one step further and added enough of its own code to Darwin to make it a stand-alone operating system.

Related Reading

Mac OS X: The Missing ManualMac OS X: The Missing Manual
By David Pogue
Table of Contents
Full Description
Sample Chapter

You can install Darwin on your computer system and have a fully functional Unix server, or activate the standard XFree86 graphics engine to turn it into a Unix desktop. Many popular Unix applications have already been ported to Darwin.

Installing Darwin as a standalone OS is much like installing BSD or Linux, especially versions that only have a text-based installer. It asks you a few questions about where you want to install it and then goes to work; it's still a very simple installer. The install notes recommend disconnecting all drives except the target drive. It says this is to prevent the accidental destruction of data on the wrong disk. This is the first release that Darwin has had its own installer, so this really isn't that unexpected.

Also new with this release, XFree86 comes installed by default. Since XFree86 for Darwin doesn't need a configuration file, you should be able to start X immediately. However, you may wish to install a different window manager than the default one.

If you're interested in working with XFree86, we've already published some articles to get you on your way. Michael Norton's Installing XFree86 on Mac OS X and my Rootless X Server on Mac OS X will provide you with all the info you need.

At this point, Darwin will feel very familiar to users of Unix. All the familiar tools are there, ranging from sed, to ssh, to vi, to Perl. It also has the standard suite of developer tools, like CVS, GCC, GNU Make, and even BSD Make.

If you register at their developer site, you can check out a current copy of the source code from CVS. If you don't register, you can get a copy on CD or download it project by project from the 1.4.1 Release site.

Apple also makes it very easy to contribute as a developer to the project. Just make your change available for download and submit a modification request at

Darwin is Open Source

Darwin is 100% open source (you can check out the source code online). It's also free via a download, or available for purchase on CD with lots of Darwin-packaged applications. To download it, go to and grab the PowerPC version (it's a CD image that needs to be written to CD before installation). You can also purchase the CD from BSD Mall.

When a project is released into the open source community, it takes on a life of its own. How it's developed doesn't necessarily correspond with the goals of company sponsoring the project. The original creators have two basic options:
  1. Ignore, squash it, and don't let changes in to the code base.
  2. Or, accept it and let the code thrive and evolve.

Apple has chosen the latter option, even to the point that there's a download available for the Intel platform.

Darwin on Intel

Comment on this articleThere are many things to discuss related to Darwin. One topic in particular is its port to the Intel platform. What have your heard or seen?
Post your comments

Yes, that is what I said. Darwin, the core of Mac OS X, is available for the Intel platform. Granted, it only works on a limited number of hardware configurations, but work is progressing to increase its compatibility on more Intel processors. This port has been coordinated entirely by volunteers in the open source community.

Here's where the supported hardware stands at this point:

  • IDE: Only the PIIX4 IDE controllers have been found to work. Attached devices must be UDMA/33 compatible or better.
  • Ethernet: Intel 8255x 10/100 ethernet controllers are supported.
  • Video: You must have a VESA 2.0-compliant video card. Almost all modern graphics cards are VESA 2.0 compliant. However, emulators such as vmware do not have VESA 2.0-compliant emulated video cards.
  • Successfully tested hardware: All 440BX motherboards tested have worked with their internal IDE controllers. IBM ThinkPad A21m (with onboard Intel ethernet)
  • Known to not be supported: All AMD- and VIA-based systems.

As you can see, the list of supported hardware is pretty slim. Also there are a few known issues to consider before installing on x86. From the release notes:

  • IDE drives may not work on x86. Try it, if it doesn't work, it's a known problem.
  • Video cards must support VESA 2.0 framebuffer modes on x86. Try it, if your console looks weird, or doesn't appear, it's a known problem.

The installer is basically the same on x86 as on PowerPC. Both require you to burn the downloaded image to CD before installing. I didn't have much luck with the spare x86 hardware I had available, but I'd be interested in hearing some success stories.

A Brief Review of the State of Darwin

  • Darwin is the BSD Unix core of Mac OS X. To create OS X, Apple takes Darwin and adds "Core Graphics," QuickTime, Carbon, Cocoa, and Aqua.
  • Darwin is a complete OS. Even though Darwin is used as a part of Mac OS X, it's a complete operating system on its own. It comes standard with XFree86 and has a wide selection of applications available.
  • Darwin is directly accessible from inside Mac Os X. You can fire up the terminal application, or install XFree86 on OS X and utilize the Darwin core directly.
  • Darwin is open source. Apple used BSD License code from FreeBSD and Mach and added their own code to create Darwin (governed by the Apple Public Source License recently approved by OSI as an Open Source License). You can become a developer of Darwin and obtain the source code.
  • Darwin is free. You can obtain it via a free download or buy it on CD. Both PowerPC and Intel versions are included on the CD set. If you download Darwin, you will need to burn it to CD to install.
  • Darwin is available for any Power PC Platform that can run Mac OS X. However, Darwin is also available for Intel hardware and Mac OS X isn't.

The code in Darwin is the same as the code used to build Mac OS X. So if you want access to the source code for Mac OS X, you need to become part of the Darwin project. The department at Apple responsible for Darwin seems very responsive to community needs and feedback. As you can tell from the inclusion of Intel support, this is a true open source project. Apple has fully embraced the open source spirit, without compromising its financial interests.