- A Mach-O System
- The BSD Layer
- Drivers
- Initialization and Startup
- Quartz Is Not X11 (But It Could Be)
- OS X is not FreeBSD
Initialization and Startup
The most noticeably unique userland feature of Darwin is launchd. This is an Apache-licensed replacement for init, cron, and inetd on other UNIX-like systems. It is the first process to be started by the kernel and can run tasks in response to network activity, timers, or when required by others.
One thing that you will notice about launchd is that it uses property lists for configuration. NeXT property lists were a simple ASCII format, and Apple has added binary and XML representations. Most system tools on OS X use the Core Foundation framework, which provides (among other things) support for reading and writing files in this format. They have the advantage that they are quite easy to edit by hand, but are also easy to parse. The use of property lists throughout OS X is one of the reasons why the GUI integrates so well with the rest of the system; it is trivial to write a Cocoa program to manipulate a property list that is used to control daemons. On contrast, most other UNIX-like systems have userland daemons that all have their own configuration formats. You will see on OS X that things like Apache and Samba, which are ported from other platforms, lack the tight integration with the GUI that native daemons provide.
The rest of the userland is a strange hybrid of FreeBSD, OPENSTEP, and GNU utilities. Some, such as ditto, date back to the NeXT era, although most have been updated. Others, such as du, df, ls, and most of the standard userland come from FreeBSD, but have been slightly modified by Apple. Most of the development related tools come from the GNU project. Make is GNU Make and cc and c99 are both GCC, although it seems likely that these will be replaced by Clang at some point in the future. In recent versions of OS X, the default shell is GNU bash, familiar to most Linux users, rather than the C shell more familiar to FreeBSD users.